Skip to content

Commit 44ef9e8

Browse files
committed
Fix resque-web config and library loading.
1 parent 438f57b commit 44ef9e8

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

HISTORY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Added `rake resque:workers` task for starting multiple workers.
44
* 1.9.x compatibility
55
* Bugfix: Yajl decoder doesn't care about valid UTF-8
6+
* config.ru loads RESQUECONFIG if the ENV variable is set.
7+
* `resque-web` now sets RESQUECONFIG
68

79
## 1.2.0 (2009-11-25)
810

bin/resque-web

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,15 @@ Common options:
3030
--version Show version
3131
usage
3232
else
33-
if !ENV['CONFIG']&&ARGV[-1]&&ARGV[-1][0]!=?-&&(ARGV[-2]?ARGV[-2][0]!=?-:true)
33+
if !ENV['RESQUECONFIG']&&ARGV[-1]&&ARGV[-1][0]!=?-&&(ARGV[-2]?ARGV[-2][0]!=?-:true)
3434
if File.file?(file = File.expand_path(ARGV[-1]))
3535
ARGV.delete_at(-1)
36-
ENV['CONFIG'] = file
36+
ENV['RESQUECONFIG'] = file
3737
else
3838
abort "** Can't find #{file}"
3939
end
4040
end
4141

42-
args = ARGV
43-
ENV['RUBYLIB'] = ENV['RUBYLIB'].to_s + ':' + __DIR__ + '/../lib'
44-
args.unshift '-e', 'require "resque";load ENV["CONFIG"] if ENV["CONFIG"]'
45-
args.push File.expand_path(File.dirname(__FILE__) + "/../config.ru")
46-
exec "rackup", *args
42+
ARGV.push File.expand_path(File.dirname(__FILE__) + "/../config.ru")
43+
exec "rackup", *ARGV
4744
end

config.ru

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@ require 'logger'
44
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/lib')
55
require 'resque/server'
66

7+
# Set the RESQUECONFIG env variable if you've a `resque.rb` or similar
8+
# config file you want loaded on boot.
9+
if ENV['RESQUECONFIG'] && File.exists?(File.expand_path(ENV['RESQUECONFIG']))
10+
load File.expand_path(ENV['RESQUECONFIG'])
11+
end
12+
713
use Rack::ShowExceptions
814
run Resque::Server.new

0 commit comments

Comments
 (0)