提交 b6f398bc 编写于 作者: J John Crepezzi

Add a host method to HashConfig

This is the last property that's used directly inside of Rails (in
`DatabaseTasks`) that doesn't have an accessor in `HashConfig`.

Adding this so that we can have a uniform interface for accessing
properties that Rails needs (that descend from
`DatabaseConfigurations::DatabaseConfig`)
Co-authored-by: Neileencodes <eileencodes@gmail.com>
上级 d7e454da
......@@ -21,6 +21,10 @@ def adapter_method
"#{adapter}_connection"
end
def host
raise NotImplementedError
end
def database
raise NotImplementedError
end
......
......@@ -53,6 +53,10 @@ def migrations_paths
configuration_hash[:migrations_paths]
end
def host
configuration_hash[:host]
end
def database
configuration_hash[:database]
end
......
......@@ -508,7 +508,7 @@ def each_local_configuration
end
def local_database?(db_config)
host = db_config.configuration_hash[:host]
host = db_config.host
host.blank? || LOCAL_HOSTS.include?(host)
end
......
......@@ -101,7 +101,7 @@ def establish_master_connection
end
def set_psql_env
ENV["PGHOST"] = configuration_hash[:host] if configuration_hash[:host]
ENV["PGHOST"] = db_config.host if db_config.host
ENV["PGPORT"] = configuration_hash[:port].to_s if configuration_hash[:port]
ENV["PGPASSWORD"] = configuration_hash[:password].to_s if configuration_hash[:password]
ENV["PGUSER"] = configuration_hash[:username].to_s if configuration_hash[:username]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册