mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-28 22:15:06 +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,
|
db: 0,
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
|
def reset!
|
||||||
|
@base = nil
|
||||||
|
@sidekiq = nil
|
||||||
|
@cache = nil
|
||||||
|
@namespace = nil
|
||||||
|
end
|
||||||
|
|
||||||
def base
|
def base
|
||||||
@base ||= setup_config(prefix: nil, defaults: DEFAULTS)
|
@base ||= setup_config(prefix: nil, defaults: DEFAULTS)
|
||||||
.merge(namespace: base_namespace)
|
.merge(namespace: base_namespace)
|
||||||
|
@ -8,14 +8,6 @@ namespace :mastodon do
|
|||||||
prompt = TTY::Prompt.new
|
prompt = TTY::Prompt.new
|
||||||
env = {}
|
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
|
begin
|
||||||
errors = false
|
errors = false
|
||||||
|
|
||||||
@ -533,6 +525,11 @@ namespace :mastodon do
|
|||||||
ENV[key] = value.to_s
|
ENV[key] = value.to_s
|
||||||
end
|
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'
|
require_relative '../../config/environment'
|
||||||
disable_log_stdout!
|
disable_log_stdout!
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user