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

Validate parameters in config file

* Ensure verbose is either true or false
* Ensure integer parameters are valid integers
This commit is contained in:
perldork 2015-05-14 13:33:26 -04:00
parent 562a858023
commit 1fc915901d

View file

@ -269,6 +269,19 @@ module Sidekiq
logger.info @parser
die(1)
end
errors = []
[:concurrency, :index, :timeout].each do |arg|
if options.has_key? arg
Integer(options[arg]) rescue errors.push("#{arg.to_s} must be an integer")
end
end
if options.has_key? :verbose
val = options[:verbose]
errors.push("verbose must be true or false") unless val == true || val == false
end
raise("Invalid configuration found: " + errors.join(", ")) unless errors.empty?
end
def parse_options(argv)