Skip to content

Commit b4150a4

Browse files
committed
redis cache: separating the different production stages.
1 parent 87d4288 commit b4150a4

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

config/application.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
::SECRETS = {}
4343
end
4444

45+
# Determine a possible staging environment.
46+
#
47+
if __FILE__.start_with?('/var/')
48+
::STAGE = __FILE__.split('/')[2] # ['wingolfsplattform', 'wingolfsplattform-master', 'wingolfsplattform-sandbox']
49+
else
50+
::STAGE = Rails.env.to_s
51+
end
52+
4553
module Wingolfsplattform
4654
class Application < Rails::Application
4755

config/environments/production.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# Caching
1111
config.action_controller.perform_caching = true
1212
# config.cache_store = :file_store, Rails.root.join("tmp/app_cache")
13-
config.cache_store = :redis_store, 'redis://localhost:6379/0/cache_production_stage', { expires_in: 1.week }
13+
config.cache_store = :redis_store, "redis://localhost:6379/0/cache_#{::STAGE}", { expires_in: 1.week }
1414

1515
# Disable Rails's static asset server (Apache or nginx will already do this)
1616
config.serve_static_assets = false

0 commit comments

Comments
 (0)