Fix cloud mode: ERB secrets, Redis auth, and Redis URL
- secrets.rb: Process ERB tags in secrets.yml and use ||= to not overwrite existing ENV vars (was clobbering SERVER_MODE=cloud with literal ERB string, causing app to fall into 'application' mode and redirect to /en/activate) - license.rb: Use ENV['REDIS_URL'] for all Redis.new calls instead of defaulting to localhost (infrastructure Redis requires auth) - redis.yml: Use ERB to read REDIS_URL env var for production - sidekiq.rb: Process ERB when loading redis.yml Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
config = YAML.load_file("#{Rails.root}/config/secrets.yml")
|
||||
config = YAML.load(ERB.new(File.read("#{Rails.root}/config/secrets.yml")).result)
|
||||
config.fetch(Rails.env, {}).each do |key, value|
|
||||
ENV[key.upcase] = value.to_s
|
||||
ENV[key.upcase] ||= value.to_s
|
||||
end
|
||||
|
||||
# SECRETS_CONFIG = YAML.load_file("#{Rails.root}/config/secrets.yml")[Rails.env]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
redis = YAML::load(File.open("#{ Rails.root }/config/redis.yml"))[::Rails.env]
|
||||
redis = YAML::load(ERB.new(File.read("#{ Rails.root }/config/redis.yml")).result)[::Rails.env]
|
||||
|
||||
Sidekiq.configure_server do |config|
|
||||
config.redis = { url: "#{ redis['url'] }/#{ redis['db'] }" }
|
||||
|
||||
@@ -10,4 +10,4 @@ test:
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
url: redis://127.0.0.1:6379
|
||||
url: <%= ENV.fetch('REDIS_URL', 'redis://127.0.0.1:6379') %>
|
||||
|
||||
Reference in New Issue
Block a user