mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
pass the yml file through erb first
This commit is contained in:
parent
3f5047f555
commit
1ba0621e02
3 changed files with 4 additions and 3 deletions
|
@ -32,6 +32,7 @@ require 'yaml'
|
|||
require 'singleton'
|
||||
require 'optparse'
|
||||
require 'celluloid'
|
||||
require 'erb'
|
||||
|
||||
require 'sidekiq'
|
||||
require 'sidekiq/util'
|
||||
|
@ -208,7 +209,7 @@ module Sidekiq
|
|||
def parse_config(cli)
|
||||
opts = {}
|
||||
if cli[:config_file] && File.exist?(cli[:config_file])
|
||||
opts = YAML.load_file cli[:config_file]
|
||||
opts = YAML.load(ERB.new(IO.read(cli[:config_file])).result)
|
||||
queues = opts.delete(:queues) || []
|
||||
queues.each { |name, weight| parse_queues(opts, name, weight) }
|
||||
end
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
:pidfile: /tmp/sidekiq-config-test.pid
|
||||
:concurrency: 50
|
||||
:queues:
|
||||
- [often, 2]
|
||||
- [<%="very_"%>often, 2]
|
||||
- [seldom, 1]
|
||||
|
|
|
@ -130,7 +130,7 @@ class TestCli < MiniTest::Unit::TestCase
|
|||
end
|
||||
|
||||
it 'sets queues' do
|
||||
assert_equal 2, Sidekiq.options[:queues].count { |q| q == 'often' }
|
||||
assert_equal 2, Sidekiq.options[:queues].count { |q| q == 'very_often' }
|
||||
assert_equal 1, Sidekiq.options[:queues].count { |q| q == 'seldom' }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue