class Sidekiq::CLI
def setup_options(args)
def setup_options(args) # parse CLI options opts = parse_options(args) set_environment opts[:environment] # check config file presence if opts[:config_file] unless File.exist?(opts[:config_file]) raise ArgumentError, "No such file #{opts[:config_file]}" end else config_dir = if File.directory?(opts[:require].to_s) File.join(opts[:require], "config") else File.join(options[:require], "config") end %w[sidekiq.yml sidekiq.yml.erb].each do |config_file| path = File.join(config_dir, config_file) opts[:config_file] ||= path if File.exist?(path) end end # parse config file options opts = parse_config(opts[:config_file]).merge(opts) if opts[:config_file] # set defaults opts[:queues] = ["default"] if opts[:queues].nil? || opts[:queues].empty? opts[:strict] = true if opts[:strict].nil? opts[:concurrency] = Integer(ENV["RAILS_MAX_THREADS"]) if opts[:concurrency].nil? && ENV["RAILS_MAX_THREADS"] # merge with defaults options.merge!(opts) end