Move self destruct check to config_for
and add constant for verifier string (#32943)
This commit is contained in:
parent
911d7dbbf6
commit
c0c34d35e2
4 changed files with 19 additions and 12 deletions
|
@ -1,9 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module SelfDestructHelper
|
||||
VERIFY_PURPOSE = 'self-destruct'
|
||||
|
||||
def self.self_destruct?
|
||||
value = ENV.fetch('SELF_DESTRUCT', nil)
|
||||
value.present? && Rails.application.message_verifier('self-destruct').verify(value) == ENV['LOCAL_DOMAIN']
|
||||
value = Rails.configuration.x.mastodon.self_destruct_value
|
||||
value.present? && Rails.application.message_verifier(VERIFY_PURPOSE).verify(value) == ENV['LOCAL_DOMAIN']
|
||||
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
||||
false
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue