From 0ed42707cce0d8e8bf8fd245496fd09d9e4e7ffe Mon Sep 17 00:00:00 2001 From: David Celis Date: Mon, 30 Dec 2013 13:39:43 -0800 Subject: [PATCH] Allow configuration of Redis DB and cache DB Hardcoding the Redis DB and Redis Caching DB to 0 and 2 in `config/database.yml` makes an unsafe assumption that Discourse is the only application using that install of redis-server. Instead of forcing users to undergo yet another form of configuration, allow Discourse admins a nicer way to configure the Redis databases used. Signed-off-by: David Celis --- config/discourse_defaults.conf | 6 ++++++ config/redis.yml | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/discourse_defaults.conf b/config/discourse_defaults.conf index 40a1cc09e83..319c0a969d7 100644 --- a/config/discourse_defaults.conf +++ b/config/discourse_defaults.conf @@ -73,5 +73,11 @@ redis_host = localhost # redis server port redis_port = 6379 +# redis database +redis_db = 0 + +# redis database for caching +redis_cache_db = 2 + # redis password redis_password = diff --git a/config/redis.yml b/config/redis.yml index 9422ecd1627..d16d29eb7f7 100644 --- a/config/redis.yml +++ b/config/redis.yml @@ -2,8 +2,8 @@ defaults: &defaults host: <%= GlobalSetting.redis_host %> port: <%= GlobalSetting.redis_port %> password: <%= GlobalSetting.redis_password %> - db: 0 - cache_db: 2 + db: <%= GlobalSetting.redis_db %> + cache_db: <%= GlobalSetting.redis_cache_db %> development: <<: *defaults