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