mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-28 05:55:04 +01:00
Fix rake mastodon:setup Redis configuration loading
Alternative to #22053
This commit is contained in:
parent
f768a6eb16
commit
f4c0f3940a
@ -7,6 +7,13 @@ class Mastodon::RedisConfiguration
|
||||
db: 0,
|
||||
}.freeze
|
||||
|
||||
def reset!
|
||||
@base = nil
|
||||
@sidekiq = nil
|
||||
@cache = nil
|
||||
@namespace = nil
|
||||
end
|
||||
|
||||
def base
|
||||
@base ||= setup_config(prefix: nil, defaults: DEFAULTS)
|
||||
.merge(namespace: base_namespace)
|
||||
|
@ -8,14 +8,6 @@ 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')
|
||||
|
||||
begin
|
||||
errors = false
|
||||
|
||||
@ -533,6 +525,11 @@ namespace :mastodon do
|
||||
ENV[key] = value.to_s
|
||||
end
|
||||
|
||||
# Redis configuration happens very early when the application code is loaded.
|
||||
# This happens before the `mastodon:setup` task runs, so we have to refresh it with
|
||||
# the new environment variable values.
|
||||
REDIS_CONFIGURATION.reset!
|
||||
|
||||
require_relative '../../config/environment'
|
||||
disable_log_stdout!
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user