forked from livingsocial/resque-web
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RAILS_RESQUE_REDIS_PASSWORD env var support
- Loading branch information
1 parent
5153bd5
commit ccb51fb
Showing
2 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
require 'resque' | ||
|
||
# Previously, this initializer always set Resque.redis, and defaulted to '127.0.0.1:6379' if | ||
# RAILS_RESQUE_REDIS was not set. | ||
|
||
# Previously, this initializer always set Resque.redis, and defaulted | ||
# to '127.0.0.1:6379' if RAILS_RESQUE_REDIS was not set. | ||
if ENV['RAILS_RESQUE_REDIS'].present? | ||
Resque.redis = ENV['RAILS_RESQUE_REDIS'] | ||
end | ||
|
||
# Have to do this to accept password because resque does not support | ||
# setting it in the string. | ||
redis_password = ENV['RAILS_RESQUE_REDIS_PASSWORD'] | ||
if redis_password.present? | ||
opts = Resque.redis.client.options | ||
redis = Redis.new(opts.merge(password: redis_password)) | ||
Resque.redis = redis | ||
end |