Add SELF_DESTRUCT env variable to process self-destructions in the background (#26439)
This commit is contained in:
parent
26d2a2a0cc
commit
379115e601
22 changed files with 193 additions and 57 deletions
14
app/helpers/self_destruct_helper.rb
Normal file
14
app/helpers/self_destruct_helper.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module SelfDestructHelper
|
||||
def self.self_destruct?
|
||||
value = ENV.fetch('SELF_DESTRUCT', nil)
|
||||
value.present? && Rails.application.message_verifier('self-destruct').verify(value) == ENV['LOCAL_DOMAIN']
|
||||
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
||||
false
|
||||
end
|
||||
|
||||
def self_destruct?
|
||||
SelfDestructHelper.self_destruct?
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue