File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed
railties/lib/rails/generators/rails/app/templates/config/databases Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,13 @@ production:
86
86
replica: true
87
87
` ` `
88
88
89
+ Connection URLs for databases can also be configured using environment variables. The variable
90
+ name is formed by concatenating the connection name with `_DATABASE_URL`. For example, setting
91
+ ` ANIMALS_DATABASE_URL="mysql2://username:password@host/database"` is merged into the `animals`
92
+ configuration in `database.yml` in the `production` environment. See
93
+ [Configuring a Database](configuring.html#configuring-a-database) for details about how the
94
+ merging works.
95
+
89
96
When using multiple databases, there are a few important settings.
90
97
91
98
First, the database name for `primary` and `primary_replica` should be the same because they contain
Original file line number Diff line number Diff line change 49
49
# production:
50
50
# url: <%%= ENV["MY_APP_DATABASE_URL"] %>
51
51
#
52
+ <%- unless options.skip_solid? -%>
53
+ # Connection URLs for non-primary databases can also be configured using
54
+ # environment variables. The variable name is formed by concatenating the
55
+ # connection name with `_DATABASE_URL`. For example:
56
+ #
57
+ # CACHE_DATABASE_URL="mysql2://cacheuser:cachepass@localhost/cachedatabase"
58
+ #
59
+ <%- end -%>
52
60
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
53
61
# for a full overview on how database connection configuration can be specified.
54
62
#
Original file line number Diff line number Diff line change 81
81
# production:
82
82
# url: <%%= ENV["MY_APP_DATABASE_URL"] %>
83
83
#
84
+ <%- unless options.skip_solid? -%>
85
+ # Connection URLs for non-primary databases can also be configured using
86
+ # environment variables. The variable name is formed by concatenating the
87
+ # connection name with `_DATABASE_URL`. For example:
88
+ #
89
+ # CACHE_DATABASE_URL="postgres://cacheuser:cachepass@localhost/cachedatabase"
90
+ #
91
+ <%- end -%>
84
92
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
85
93
# for a full overview on how database connection configuration can be specified.
86
94
#
Original file line number Diff line number Diff line change 51
51
# production:
52
52
# url: <%%= ENV["MY_APP_DATABASE_URL"] %>
53
53
#
54
+ <%- unless options.skip_solid? -%>
55
+ # Connection URLs for non-primary databases can also be configured using
56
+ # environment variables. The variable name is formed by concatenating the
57
+ # connection name with `_DATABASE_URL`. For example:
58
+ #
59
+ # CACHE_DATABASE_URL="trilogy://cacheuser:cachepass@localhost/cachedatabase"
60
+ #
61
+ <%- end -%>
54
62
# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
55
63
# for a full overview on how database connection configuration can be specified.
56
64
#
You can’t perform that action at this time.
0 commit comments