diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index 2338b4393f..0081b4a8f6 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -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"