action_cable_preferences.rb 680 B

12345678910111213141516171819
  1. # Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
  2. if ENV['REDIS_URL'].present?
  3. Rails.application.config.action_cable.cable = {
  4. 'adapter' => 'redis',
  5. 'url' => ENV['REDIS_URL'],
  6. 'channel_prefix' => "zammad_#{Rails.env}"
  7. }
  8. Rails.logger.info 'Using the Redis adapter for ActionCable.'
  9. else
  10. if ActiveRecord::Base.connection_config[:adapter] == 'mysql'
  11. raise 'Please provide a working redis instance via REDIS_URL - this is required on MySQL databases.'
  12. end
  13. Rails.application.config.action_cable.cable = {
  14. 'adapter' => 'postgresql',
  15. }
  16. Rails.logger.info 'Using the PostgreSQL adapter for ActionCable.'
  17. end