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:
parent
b2fb0afca4
commit
26f983b39a
3 changed files with 29 additions and 0 deletions
|
@ -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
|
||||
|
|
11
test/config_with_internal_options.yml
Normal file
11
test/config_with_internal_options.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
:verbose: false
|
||||
:timeout: 10
|
||||
:require: ./test/fake_env.rb
|
||||
:concurrency: 50
|
||||
:tag: tag
|
||||
:queues:
|
||||
- [often]
|
||||
- [seldom]
|
||||
|
||||
:strict: false
|
|
@ -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])
|
||||
|
|
Loading…
Reference in a new issue