Sha256: f3a84bac2dc0b27db707ecef2eac2907f5e6ef585f3efe8dae91e81da513e048
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true module Karafka module Web module Management module Actions # Extends the boot file with Web components class ExtendBootFile < Base # Code that is needed in the `karafka.rb` to connect Web UI to Karafka ENABLER_CODE = 'Karafka::Web.enable!' # Template with initial Web UI configuration # Session secret needs to be set per user and per env SETUP_TEMPLATE = <<~CONFIG.freeze Karafka::Web.setup do |config| # You may want to set it per ENV. This value was randomly generated. config.ui.sessions.secret = '#{SecureRandom.hex(32)}' end #{ENABLER_CODE} CONFIG # Adds needed code def call if File.read(Karafka.boot_file).include?(ENABLER_CODE) puts "Web UI #{already} installed." else puts 'Updating the Karafka boot file...' File.open(Karafka.boot_file, 'a') do |f| f << "\n#{SETUP_TEMPLATE}\n" end puts "Karafka boot file #{successfully} updated." end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
karafka-web-0.8.0 | lib/karafka/web/management/actions/extend_boot_file.rb |
karafka-web-0.8.0.rc1 | lib/karafka/web/management/actions/extend_boot_file.rb |