File tree 2 files changed +11
-3
lines changed 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -38,8 +38,12 @@ def database_yml(db_driver)
38
38
39
39
database = db_driver . out
40
40
deploy_environment = deploy_env
41
- replica_db_settings = node [ 'deploy' ] [ app [ 'shortname' ] ] [ 'replica_db_settings' ]
42
- database [ :replica ] = replica_db_settings unless replica_db_settings . nil?
41
+
42
+ # this will ensure that replica settings are available in the database.yml file so that
43
+ # staging and production database settings have similar settings
44
+ replica_database = node [ 'deploy' ] [ app [ 'shortname' ] ] [ 'replica_db_settings' ] &.dup
45
+ replica_database = database . dup if replica_database . nil?
46
+ replica_database [ :replica ] = true
43
47
44
48
factory_database = node [ 'deploy' ] [ app [ 'shortname' ] ] [ 'factory_database' ]
45
49
@@ -50,6 +54,7 @@ def database_yml(db_driver)
50
54
group www_group
51
55
variables (
52
56
database : database ,
57
+ replica : replica_database ,
53
58
environment : deploy_environment ,
54
59
factory_database : factory_database
55
60
)
Original file line number Diff line number Diff line change 1
1
<%=
2
2
config = {}
3
3
(['development', 'production'] + Array.wrap(@environment)).select(&:present?).uniq.each do |env|
4
- config[env] = @database
4
+ config[env] = {
5
+ primary: @database,
6
+ primary_replica: @replica
7
+ }
5
8
end
6
9
7
10
if @factory_database
You can’t perform that action at this time.
0 commit comments