title: Sidekiq configuration for multiple environments
body: <p>I have looked at multiple sources and tried various scenarios but couldn't resolve this hence the issue. Please point me in the right direction.</p>
  
  <p>Like everybody I have 3 env (development, staging and production). </p>
  
  <p>I have the following in my sidekiq.yml file </p>
  
  <pre><code># Options here can still be overridden by cmd line args.
  #   sidekiq -C config.yml  
  ---
  :verbose: false
  :namespace: xyz
  :logfile: log/sidekiq.log
  :concurrency:  25
  :strict: false
  :pidfile: tmp/pids/sidekiq.pid
  :queues:
    - [stg_xyz_tests_queue, 10]
    - [stg_default_xyz_queue, 2]
    - [stg_xyz_default_queue, 3]
  development:
    :verbose: true
    :concurrency:  15
    :queues:
      - [dev_xyz_queue, 10]
      - [dev_default_xyz_queue, 2]
      - [dev_xyz_default_queue, 3]
  staging:
    :queues:
      - [stg_xyz_queue, 10]
      - [stg_default_xyz_queue, 2]
      - [stg_xyz_default_queue, 3]
  production:
    :queues:
      - [prod_xyz_queue, 10]
      - [prod_default_xyz_queue, 2]
      - [prod_xyz_default_queue, 3]
  </code></pre>
  
  <p>With this I was hoping that when I start sidekiq with the command </p>
  
  <pre><code>RAILS_ENV=#{rails_env} bundle exec sidekiq -C config/sidekiq.yml
  </code></pre>
  
  <p>that it would pickup all the values from the configuration file and start sidekiq with the appropriate queues and log file at log/sidekiq.log but that doesn't work. 
  Sidekiq starts but it only creates the stg_xyz_tests_queue, stg_default_xyz_queue and stg_xyz_default_queue no matter what environment we use. </p>
  
  <p>The other approach I tried was using the following code in the config/environments/development.rb</p>
  
  <pre><code>  #configure Sidekiq for dev environment
    Sidekiq.configure_server do |config|
      config.options[:namespace] = "xyz"
      config.options[:concurrency] = 25
      config.options[:verbose] = true
      config.options[:strict] = false
      config.options[:logfile] = "log/sidekiq.log"
      config.options[:pidfile] = "tmp/pids/sidekiq.pid"
  
      queues = Array.new
      10.times do
        queues.push "dev_xyz_queue"
      end
  
      2.times do
        queues.push "dev_default_xyz_queue"
      end
  
      3.times do
        queues.push "dev_xyz_default_queue"
      end
  
      config.options[:queues] = queues
      puts "Sidekiq server config options for development =&gt; #{config.options.to_yaml}"
    end
  </code></pre>
  
  <p>With this the queues are created ok but the logfile is not created or written and I need to duplicate this code for all the 3 environments.</p>
  
  <p>What is the best way to get sidekiq working seamlessly for my setup
  Thanks for your help in advance !!!</p>