1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Do not allow to set strict via the config file (#4557)

This commit is contained in:
Manoj M J 2020-05-07 21:30:19 +05:30 committed by GitHub
parent b2fb0afca4
commit 26f983b39a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 0 deletions

View file

@ -357,6 +357,12 @@ module Sidekiq
Sidekiq.logger.level = ::Logger::DEBUG if options[:verbose]
end
INTERNAL_OPTIONS = [
# These are options that are set internally and cannot be
# set via the config file or command line arguments.
:strict
]
def parse_config(path)
opts = YAML.load(ERB.new(File.read(path)).result) || {}
@ -367,6 +373,8 @@ module Sidekiq
end
opts = opts.merge(opts.delete(environment.to_sym) || {})
opts.delete(*INTERNAL_OPTIONS)
parse_queues(opts, opts.delete(:queues) || [])
opts

View file

@ -0,0 +1,11 @@
---
:verbose: false
:timeout: 10
:require: ./test/fake_env.rb
:concurrency: 50
:tag: tag
:queues:
- [often]
- [seldom]
:strict: false

View file

@ -62,6 +62,16 @@ describe Sidekiq::CLI do
end
end
describe 'setting internal options via the config file' do
describe 'setting the `strict` option via the config file' do
it 'discards the `strict` option specified via the config file' do
subject.parse(%w[sidekiq -C ./test/config_with_internal_options.yml])
assert_equal true, !!Sidekiq.options[:strict]
end
end
end
describe 'queues' do
it 'accepts with -q' do
subject.parse(%w[sidekiq -q foo -r ./test/fake_env.rb])