diff --git a/app/models/application_record.rb b/app/models/application_record.rb index c2de8fb2af..567542f91d 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -5,7 +5,7 @@ class ApplicationRecord < ActiveRecord::Base include Remotable - connects_to database: { writing: :primary, reading: ENV['DB_REPLICA_NAME'] || ENV['REPLICA_DATABASE_URL'] ? :replica : :primary } + connects_to database: { writing: :primary, reading: ENV['REPLICA_DB_NAME'] || ENV['REPLICA_DATABASE_URL'] ? :replica : :primary } class << self def update_index(_type_name, *_args, &_block) diff --git a/config/database.yml b/config/database.yml index 0907193feb..b995f23178 100644 --- a/config/database.yml +++ b/config/database.yml @@ -55,10 +55,10 @@ production: prepared_statements: <%= ENV['PREPARED_STATEMENTS'] || 'true' %> replica: <<: *default - database: <%= ENV['DB_REPLICA_NAME'] ||ENV['DB_NAME'] || 'mastodon_production' %> - username: <%= ENV['DB_REPLICA_USER'] ||ENV['DB_USER'] || 'mastodon' %> - password: <%= (ENV['DB_REPLICA_PASS'] || ENV['DB_PASS'] || '').to_json %> - host: <%= ENV['DB_REPLICA_HOST'] ||ENV['DB_HOST'] || 'localhost' %> - port: <%= ENV['DB_REPLICA_PORT'] ||ENV['DB_PORT'] || 5432 %> + database: <%= ENV['REPLICA_DB_NAME'] ||ENV['DB_NAME'] || 'mastodon_production' %> + username: <%= ENV['REPLICA_DB_USER'] ||ENV['DB_USER'] || 'mastodon' %> + password: <%= (ENV['REPLICA_DB_PASS'] || ENV['DB_PASS'] || '').to_json %> + host: <%= ENV['REPLICA_DB_HOST'] ||ENV['DB_HOST'] || 'localhost' %> + port: <%= ENV['REPLICA_DB_PORT'] ||ENV['DB_PORT'] || 5432 %> prepared_statements: <%= ENV['PREPARED_STATEMENTS'] || 'true' %> replica: true