Permalink
Browse files

move redis host config to a YAML file

  • Loading branch information...
1 parent b898644 commit 4ec3652aca40af152903e237b73bfda3c9fb9cd0 @benilovj benilovj committed Mar 13, 2013
Showing with 11 additions and 1 deletion.
  1. +4 −1 config/application.rb
  2. +7 −0 config/redis.yml
View
@@ -8,6 +8,8 @@
require "sprockets/railtie"
require "rails/test_unit/railtie"
+require 'yaml'
+
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
@@ -49,9 +51,10 @@ class Application < Rails::Application
# Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true
+ redis_config = YAML.load_file(File.join(Rails.root, "config", "redis.yml"))[Rails.env]
config.cache_store = [
:redis_store,
- "redis://#{ENV['REDIS_HOST'] || 'localhost:6379'}",
+ "redis://#{redis_config['host']}:#{redis_config['port']}",
{ expires_in: 24.hours, namespace: "support-#{Rails.env}" }
]
View
@@ -0,0 +1,7 @@
+development:
+ host: localhost
+ port: 6379
+
+test:
+ host: localhost
+ port: 6379

0 comments on commit 4ec3652

Please sign in to comment.