mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 05:09:38 +02:00
Fix database config for non-devcontainer environments (#318)
Back in this [commit](5f50ea3f02 (diff-5a674c769541a71f2471a45c0e9dde911b4455344e3131bddc5a363701ba6325R22-R23)
) I added a default postgres user and password.
Often this is not the user and password that is used in non-devcontainer environments.
This commit uses environment variables that are set in the devcontainer to set the user and password in the database.yml file.
If the environment variables are not set, it falls back to the default user and password on the users system.
This commit is contained in:
parent
e812b715d3
commit
d4751053f3
2 changed files with 4 additions and 2 deletions
|
@ -18,6 +18,8 @@ services:
|
||||||
environment:
|
environment:
|
||||||
DB_HOST: db
|
DB_HOST: db
|
||||||
HOST: "0.0.0.0"
|
HOST: "0.0.0.0"
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
|
|
@ -19,8 +19,8 @@ default: &default
|
||||||
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
# https://guides.rubyonrails.org/configuring.html#database-pooling
|
||||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||||
host: <%= ENV.fetch("DB_HOST") { "127.0.0.1" } %>
|
host: <%= ENV.fetch("DB_HOST") { "127.0.0.1" } %>
|
||||||
password: postgres
|
password: <%= ENV.fetch("POSTGRES_PASSWORD") { nil } %>
|
||||||
user: postgres
|
user: <%= ENV.fetch("POSTGRES_USER") { nil } %>
|
||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *default
|
<<: *default
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue