mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 17:40:43 +08:00
FEATURE: AR adapter to failover to a replica DB server.
This commit is contained in:
@ -18,11 +18,14 @@ class GlobalSetting
|
||||
|
||||
def self.database_config
|
||||
hash = {"adapter" => "postgresql"}
|
||||
%w{pool timeout socket host port username password}.each do |s|
|
||||
%w{pool timeout socket host port username password replica_host replica_port}.each do |s|
|
||||
if val = self.send("db_#{s}")
|
||||
hash[s] = val
|
||||
end
|
||||
end
|
||||
|
||||
hash["adapter"] = "postgresql_fallback" if hash["replica_host"]
|
||||
|
||||
hostnames = [ hostname ]
|
||||
hostnames << backup_hostname if backup_hostname.present?
|
||||
|
||||
|
Reference in New Issue
Block a user