From b4150a4c805f2a71e9b9575e3fb8ad5ba4a9dc8b Mon Sep 17 00:00:00 2001 From: Sebastian Fiedlschuster Date: Fri, 26 Sep 2014 21:42:45 +0200 Subject: [PATCH] redis cache: separating the different production stages. --- config/application.rb | 8 ++++++++ config/environments/production.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 8ec440c03..d8fd55a77 100644 --- a/config/application.rb +++ b/config/application.rb @@ -42,6 +42,14 @@ ::SECRETS = {} end +# Determine a possible staging environment. +# +if __FILE__.start_with?('/var/') + ::STAGE = __FILE__.split('/')[2] # ['wingolfsplattform', 'wingolfsplattform-master', 'wingolfsplattform-sandbox'] +else + ::STAGE = Rails.env.to_s +end + module Wingolfsplattform class Application < Rails::Application diff --git a/config/environments/production.rb b/config/environments/production.rb index 9dda6effd..486667d94 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -10,7 +10,7 @@ # Caching config.action_controller.perform_caching = true # config.cache_store = :file_store, Rails.root.join("tmp/app_cache") - config.cache_store = :redis_store, 'redis://localhost:6379/0/cache_production_stage', { expires_in: 1.week } + config.cache_store = :redis_store, "redis://localhost:6379/0/cache_#{::STAGE}", { expires_in: 1.week } # Disable Rails's static asset server (Apache or nginx will already do this) config.serve_static_assets = false