demarches-normaliennes/config/initializers/kredis.rb
Colin Darie 321409eb25
Merge pull request #10514 from colinux/redis-timeout
Tech: réduit le connect timeout de redis d'1s à 0.2s
2024-06-14 11:40:06 +00:00

8 lines
421 B
Ruby

redis_shared_options = {
url: ENV['REDIS_CACHE_URL'], # will fallback to default redis url if empty, and won't fail if there is no redis server
ssl: ENV['REDIS_CACHE_SSL'] == 'enabled',
connect_timeout: 0.2
}
redis_shared_options[:ssl_params] = { verify_mode: OpenSSL::SSL::VERIFY_NONE } if ENV['REDIS_CACHE_SSL_VERIFY_NONE'] == 'enabled'
Kredis::Connections.connections[:shared] = Redis.new(redis_shared_options)