diff options
Diffstat (limited to 'config/application.rb')
-rw-r--r-- | config/application.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/config/application.rb b/config/application.rb index 58a5949c653..68dce05fc59 100644 --- a/config/application.rb +++ b/config/application.rb @@ -73,5 +73,24 @@ module Gitlab resource '/api/*', headers: :any, methods: [:get, :post, :options, :put, :delete] end end + + # Use Redis caching across all environments + redis_config_file = Rails.root.join('config', 'resque.yml') + + redis_url_string = if File.exists?(redis_config_file) + YAML.load_file(redis_config_file)[Rails.env] + else + "redis://localhost:6379" + end + + # Redis::Store does not handle Unix sockets well, so let's do it for them + redis_config_hash = Redis::Store::Factory.extract_host_options_from_uri(redis_url_string) + redis_uri = URI.parse(redis_url_string) + if redis_uri.scheme == 'unix' + redis_config_hash[:path] = redis_uri.path + end + + redis_config_hash[:namespace] = 'cache:gitlab' + config.cache_store = :redis_store, redis_config_hash end end |