Class: ActivePostgres::Rails::DatabaseConfig::Builder
- Inherits:
-
Object
- Object
- ActivePostgres::Rails::DatabaseConfig::Builder
- Defined in:
- lib/active_postgres/rails/database_config.rb
Instance Attribute Summary collapse
-
#app_name ⇒ Object
readonly
Returns the value of attribute app_name.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
Instance Method Summary collapse
- #build_connections ⇒ Object
-
#initialize(environment, app_name: nil, config: nil) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(environment, app_name: nil, config: nil) ⇒ Builder
Returns a new instance of Builder.
62 63 64 65 66 |
# File 'lib/active_postgres/rails/database_config.rb', line 62 def initialize(environment, app_name: nil, config: nil) @environment = environment @app_name = normalize_app_name(app_name) @config = config || Configuration.load('config/postgres.yml', environment) end |
Instance Attribute Details
#app_name ⇒ Object (readonly)
Returns the value of attribute app_name.
60 61 62 |
# File 'lib/active_postgres/rails/database_config.rb', line 60 def app_name @app_name end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
60 61 62 |
# File 'lib/active_postgres/rails/database_config.rb', line 60 def config @config end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
60 61 62 |
# File 'lib/active_postgres/rails/database_config.rb', line 60 def environment @environment end |
Instance Method Details
#build_connections ⇒ Object
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/active_postgres/rails/database_config.rb', line 68 def build_connections connections = { 'primary' => deep_merge(base_connection, primary_connection_overrides) } replica_config = replica_connection_overrides connections['primary_replica'] = deep_merge(base_connection, replica_config) if replica_config connections end |