From 4bf0c0276384c9a6305dc69e8a53a9c8f99a0146 Mon Sep 17 00:00:00 2001 From: Henne Vogelsang Date: Sat, 16 Feb 2019 00:36:35 +0100 Subject: [PATCH] Use our env naming convention for memcached Also do not set memore_store in the production environment if there is no memcached. File based cache is default for a reason, it even works for most normal traffic pages --- config/environments/production.rb | 10 ++++------ dotenv.example | 5 +++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 357dcb55..7291c6fa 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -50,13 +50,11 @@ Osem::Application.configure do # Use a different cache store in production # config.cache_store = :mem_cache_store - if ENV["MEMCACHEDCLOUD_SERVERS"] - config.cache_store = :dalli_store, ENV["MEMCACHEDCLOUD_SERVERS"].split(','), { - username: ENV["MEMCACHEDCLOUD_USERNAME"], - password: ENV["MEMCACHEDCLOUD_PASSWORD"] + if ENV["OSEM_MEMCACHED_SERVERS"] + config.cache_store = :mem_cache_store, ENV["OSEM_MEMCACHED_SERVERS"].split(','), { + username: ENV["OSEM_MEMCACHED_USERNAME"], + password: ENV["OSEM_MEMCACHED_PASSWORD"] } - else - config.cache_store = :memory_store, { size: 64.megabytes } end # Enable serving of images, stylesheets, and JavaScripts from an asset server diff --git a/dotenv.example b/dotenv.example index 17877760..ca6bbfa8 100644 --- a/dotenv.example +++ b/dotenv.example @@ -27,6 +27,11 @@ # The name of the database # OSEM_DB_NAME=osem_production +# The memached servers to use, default is a file based cache +# OSEM_MEMCACHED_SERVERS='cache-1.example.com,cache-2.example.com' +# OSEM_MEMCACHED_USERNAME='root' +# OSEM_MEMCACHED_PASSWORD='1234' + # The ruby version to use # OSEM_RUBY_VERSION=2.5.0