1
0
Fork 0
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:
Rob Zolkos 2024-02-05 23:17:50 -05:00 committed by GitHub
parent e812b715d3
commit d4751053f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -18,6 +18,8 @@ services:
environment:
DB_HOST: db
HOST: "0.0.0.0"
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
depends_on:
- db

View file

@ -19,8 +19,8 @@ default: &default
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
host: <%= ENV.fetch("DB_HOST") { "127.0.0.1" } %>
password: postgres
user: postgres
password: <%= ENV.fetch("POSTGRES_PASSWORD") { nil } %>
user: <%= ENV.fetch("POSTGRES_USER") { nil } %>
development:
<<: *default