diff --git a/lib/sidekiq/cli.rb b/lib/sidekiq/cli.rb index 7f837519..2de1e191 100644 --- a/lib/sidekiq/cli.rb +++ b/lib/sidekiq/cli.rb @@ -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 diff --git a/test/config_with_internal_options.yml b/test/config_with_internal_options.yml new file mode 100644 index 00000000..fe5da7b6 --- /dev/null +++ b/test/config_with_internal_options.yml @@ -0,0 +1,11 @@ +--- +:verbose: false +:timeout: 10 +:require: ./test/fake_env.rb +:concurrency: 50 +:tag: tag +:queues: + - [often] + - [seldom] + +:strict: false diff --git a/test/test_cli.rb b/test/test_cli.rb index b0eb6595..74726393 100644 --- a/test/test_cli.rb +++ b/test/test_cli.rb @@ -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])