vcr_mask_zendesk_sensitive_data.rb 629 B

1234567891011
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. VCR.configure do |c|
  3. # The API key is used only inside the base64 encoded Basic Auth string, so mask that as well.
  4. c.filter_sensitive_data('<IMPORT_ZENDESK_ENDPOINT_BASIC_AUTH>') { Base64.encode64("#{ENV['IMPORT_ZENDESK_ENDPOINT_USERNAME']}/token:#{ENV['IMPORT_ZENDESK_ENDPOINT_KEY']}").lines(chomp: true).join }
  5. # The hostname of the Zendesk endpoint URL used as well
  6. if ENV['IMPORT_ZENDESK_ENDPOINT'].present?
  7. c.filter_sensitive_data('<IMPORT_ZENDESK_ENDPOINT_HOSTNAME>') { URI.parse(ENV['IMPORT_ZENDESK_ENDPOINT']).hostname }
  8. end
  9. end