From faa44c0a91a435d80279599f4557fb238d1084a7 Mon Sep 17 00:00:00 2001 From: Maxwell Salzberg Date: Wed, 7 Sep 2011 15:59:38 -0700 Subject: [PATCH] make redis url configurable via app config --- config/application.yml.example | 2 ++ config/initializers/resque.rb | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/config/application.yml.example b/config/application.yml.example index b1f8e1ebd..7ecb39998 100644 --- a/config/application.yml.example +++ b/config/application.yml.example @@ -144,6 +144,8 @@ defaults: &defaults #Hoptoad api key hoptoad_api_key: '' + #url for a remote redis, on the default port. Don't forget to restrict IP access! + redis_url: '' # Use this section to override default settings in specific environments development: <<: *defaults diff --git a/config/initializers/resque.rb b/config/initializers/resque.rb index ce88bde9f..eddb928dc 100644 --- a/config/initializers/resque.rb +++ b/config/initializers/resque.rb @@ -1,5 +1,10 @@ require 'resque' + +if !ENV['SINGLE_PROCESS'] && AppConfig[:redis_url] + Resque.redis = Redis.new(:host => AppConfig[:redis_url], :port => 6379) +end + begin if ENV['SINGLE_PROCESS'] if Rails.env == 'production'