Commit 0a52b70b authored by Jacob Vosmaer's avatar Jacob Vosmaer

Hide configuration shenanigans in a block

I'm feeling paranoid about the scope variables like redis_config_file
get defined in. Hiding it in a block to limit the scope.
parent 6d785aba
redis_config_file = Rails.root.join('config', 'resque.yml')
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_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::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'
redis_config_hash[:namespace] = 'cache:gitlab'
Gitlab::Application.config.cache_store = :redis_store, redis_config_hash
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