Skip to content

Commit

Permalink
update installer
Browse files Browse the repository at this point in the history
  • Loading branch information
mensfeld committed Sep 4, 2023
1 parent f859d2e commit d828bc1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/karafka/web/management/extend_boot_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class ExtendBootFile < Base
# Session secret needs to be set per user and per env
SETUP_TEMPLATE = <<~CONFIG
Karafka::Web.setup do |config|
# You may want to set it per ENV
config.ui.sessions.secret = '#{SecureRandom.hex(64)}'
# You may want to set it per ENV. This value was randomly generated.
config.ui.sessions.secret = '#{SecureRandom.hex(32)}'
end
#{ENABLER_CODE}
Expand Down
11 changes: 9 additions & 2 deletions spec/lib/karafka/web/management/extend_boot_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,16 @@

before { File.write(boot_file, content) }

it 'expect to add it at the end' do
it 'expect to add the enabled' do
extend_boot_file
expect(File.read(boot_file)).to eq("#{content}\nKarafka::Web.enable!\n")
expect(File.read(boot_file)).to include("\nKarafka::Web.enable!\n")
end

it 'expect to add the configurator' do
extend_boot_file
updated = File.read(boot_file)
expect(updated).to include('config.ui.sessions.secret')
expect(updated).to include('Karafka::Web.setup do |config|')
end
end
end

0 comments on commit d828bc1

Please sign in to comment.