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

pull/2976/head
Matt Jankowski 2025-01-16 10:45:02 -05:00 committed by Claire
parent 11baa26db2
commit 37b029d400
1 changed files with 12 additions and 7 deletions

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"