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:
commit
a48e7bee39
1 changed files with 19 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue