Move clear environment portion of mastodon:setup to private method (#33616)

This commit is contained in:
Matt Jankowski 2025-01-16 10:45:02 -05:00 committed by GitHub
parent 29b355b699
commit a19141441d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,13 +8,7 @@ namespace :mastodon do
prompt = TTY::Prompt.new
env = {}
# When the application code gets loaded, it runs `lib/mastodon/redis_configuration.rb`.
# This happens before application environment configuration and sets REDIS_URL etc.
# These variables are then used even when REDIS_HOST etc. are changed, so clear them
# out so they don't interfere with our new configuration.
ENV.delete('REDIS_URL')
ENV.delete('CACHE_REDIS_URL')
ENV.delete('SIDEKIQ_REDIS_URL')
clear_environment!
begin
errors = []
@ -580,6 +574,17 @@ namespace :mastodon do
private
def clear_environment!
# When the application code gets loaded, it runs `lib/mastodon/redis_configuration.rb`.
# This happens before application environment configuration and sets REDIS_URL etc.
# These variables are then used even when REDIS_HOST etc. are changed, so clear them
# out so they don't interfere with our new configuration.
ENV.delete('REDIS_URL')
ENV.delete('CACHE_REDIS_URL')
ENV.delete('SIDEKIQ_REDIS_URL')
end
def generate_header(include_warning)
default_message = "# Generated with mastodon:setup on #{Time.now.utc}\n\n"