logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

redis_config.rb (544B)


  1. # frozen_string_literal: true
  2. if ENV['REDIS_URL'].blank?
  3. password = ENV.fetch('REDIS_PASSWORD') { '' }
  4. host = ENV.fetch('REDIS_HOST') { 'localhost' }
  5. port = ENV.fetch('REDIS_PORT') { 6379 }
  6. db = ENV.fetch('REDIS_DB') { 0 }
  7. ENV['REDIS_URL'] = "redis://#{password.blank? ? '' : ":#{password}@"}#{host}:#{port}/#{db}"
  8. end
  9. namespace = ENV.fetch('REDIS_NAMESPACE') { nil }
  10. cache_namespace = namespace ? namespace + '_cache' : 'cache'
  11. REDIS_CACHE_PARAMS = {
  12. expires_in: 10.minutes,
  13. namespace: cache_namespace,
  14. }.freeze