self_destruct_helper.rb 382 B

1234567891011121314
  1. # frozen_string_literal: true
  2. module SelfDestructHelper
  3. def self.self_destruct?
  4. value = ENV.fetch('SELF_DESTRUCT', nil)
  5. value.present? && Rails.application.message_verifier('self-destruct').verify(value) == ENV['LOCAL_DOMAIN']
  6. rescue ActiveSupport::MessageVerifier::InvalidSignature
  7. false
  8. end
  9. def self_destruct?
  10. SelfDestructHelper.self_destruct?
  11. end
  12. end