Commit dc22419c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'redis/cache_settings' into 'master'

Move cache setup to config/application.rb

See merge request !1050
parents ad98c8c9 185e7681
...@@ -73,5 +73,24 @@ module Gitlab ...@@ -73,5 +73,24 @@ module Gitlab
resource '/api/*', headers: :any, methods: [:get, :post, :options, :put, :delete] resource '/api/*', headers: :any, methods: [:get, :post, :options, :put, :delete]
end end
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
end end
Gitlab::Application.configure do
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment