store_provider_check.rb 663 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. Rails.application.config.after_initialize do
  3. next if !Rails.const_defined?(:Server)
  4. next if !Rails.env.production?
  5. storage_provider = Setting.get('storage_provider')
  6. next if %w[DB File].include?(storage_provider)
  7. begin
  8. adapter = "Store::Provider::#{storage_provider}".constantize
  9. adapter.ping!
  10. rescue Store::Provider::S3::Error => e
  11. adapter.reset
  12. warn e.message
  13. warn "There was an error trying to use storage provider '#{storage_provider}'."
  14. warn 'Please check the storage provider configuration.'
  15. Zammad::SafeMode.continue_or_exit!
  16. end
  17. end