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

Merge pull request #2352 from TeachstoneLLC/ms/better_configuration_file_parameter_validation

Validate parameters in config file
This commit is contained in:
Mike Perham 2015-05-15 09:36:22 -07:00
commit a48e7bee39

View file

@ -269,6 +269,25 @@ module Sidekiq
logger.info @parser
die(1)
end
# Ensure numeric option values are numbers and fall in reasonable ranges
[:concurrency, :timeout].each do |option|
next unless options.has_key?(option)
unless options[option].is_a? Integer
raise(
ArgumentError,
%{"#{option}": "#{options[option]}" is not a valid integer}
)
end
if options[option] <= 0
raise(
ArgumentError,
%{"#{option}": must be > 0 (current value: #{options[option]})}
)
end
end
end
def parse_options(argv)