Skip to content

Commit

Permalink
Merge pull request #122 from maxkwallace/master
Browse files Browse the repository at this point in the history
Resque-web should not set the global Resque.redis
  • Loading branch information
kirillplatonov authored Apr 4, 2017
2 parents 933846d + 070ac92 commit f8086ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ MyApp::Application.routes.draw do
end
```

If you need a non-default resque server, use this environment variable.
If `RAILS_RESQUE_REDIS` is set in `ENV` and is not the empty string, this gem will set `Resque.redis` equal to `ENV['RAILS_RESQUE_REDIS']` in an initializer.

For info on configuring Resque itself (and accepted values of `Resque.redis`) see [the Configuration section of the Resque README](https://github.com/resque/resque#configuration).


```
RAILS_RESQUE_REDIS=123.x.0.456:6712
```
## Security

You almost certainly want to limit access when using resque-web in production. Using [routes constraints](http://guides.rubyonrails.org/routing.html#request-based-constraints) is one way to achieve this:
Expand Down
8 changes: 6 additions & 2 deletions config/initializers/resque_config.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
require 'resque'

config = ENV.fetch("RAILS_RESQUE_REDIS", "127.0.0.1:6379")
Resque.redis = config
# 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'] && ENV['RAILS_RESQUE_REDIS'].length
Resque.redis = ENV['RAILS_RESQUE_REDIS']
end

0 comments on commit f8086ec

Please sign in to comment.