Use heredoc on federation CLI warning strings (#28578)

This commit is contained in:
Matt Jankowski 2024-01-04 04:21:27 -05:00 committed by GitHub
parent f06c1f1552
commit 1af5c37701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 7 deletions

View File

@ -48,19 +48,31 @@ module Mastodon::CLI
exit(1) unless ask('Type in the domain of the server to confirm:') == Rails.configuration.x.local_domain exit(1) unless ask('Type in the domain of the server to confirm:') == Rails.configuration.x.local_domain
say('This operation WILL NOT be reversible.', :yellow) say(<<~WARNING, :yellow)
say('While the data won\'t be erased locally, the server will be in a BROKEN STATE afterwards.', :yellow) This operation WILL NOT be reversible.
say('The deletion process itself may take a long time, and will be handled by Sidekiq, so do not shut it down until it has finished (you will be able to re-run this command to see the state of the self-destruct process).', :yellow) While the data won't be erased locally, the server will be in a BROKEN STATE afterwards.
The deletion process itself may take a long time, and will be handled by Sidekiq, so do not shut it down until it has finished (you will be able to re-run this command to see the state of the self-destruct process).
WARNING
exit(1) if no?('Are you sure you want to proceed?') exit(1) if no?('Are you sure you want to proceed?')
self_destruct_value = Rails.application.message_verifier('self-destruct').generate(Rails.configuration.x.local_domain) say(<<~INSTRUCTIONS, :green)
say('To switch Mastodon to self-destruct mode, add the following variable to your evironment (e.g. by adding a line to your `.env.production`) and restart all Mastodon processes:', :green) To switch Mastodon to self-destruct mode, add the following variable to your evironment (e.g. by adding a line to your `.env.production`) and restart all Mastodon processes:
say(" SELF_DESTRUCT=#{self_destruct_value}", :green) SELF_DESTRUCT=#{self_destruct_value}
say("\nYou can re-run this command to see the state of the self-destruct process.", :green) You can re-run this command to see the state of the self-destruct process.
INSTRUCTIONS
rescue Interrupt rescue Interrupt
exit(1) exit(1)
end end
private
def self_destruct_value
Rails
.application
.message_verifier('self-destruct')
.generate(Rails.configuration.x.local_domain)
end
end end
end end
end end