storage_provider.rb 573 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Setting::Validation::StorageProvider < Setting::Validation::Base
  3. def run
  4. return result_success if value.blank?
  5. msg = verify_configuration
  6. return result_failed(msg) if !msg.nil?
  7. result_success
  8. end
  9. private
  10. def verify_configuration
  11. return if !value.eql?('S3')
  12. begin
  13. Store::Provider::S3.reset
  14. Store::Provider::S3.ping!
  15. rescue Store::Provider::S3::Error => e
  16. Store::Provider::S3.reset
  17. return e.message
  18. end
  19. nil
  20. end
  21. end