Parametrize database credentials via DB_* environment variables - #950
Open
eduardosmaniotto wants to merge 2 commits into
Open
Parametrize database credentials via DB_* environment variables#950eduardosmaniotto wants to merge 2 commits into
eduardosmaniotto wants to merge 2 commits into
Conversation
The postgres admin user/password was effectively hardcoded to postgres/admin across the compose deployments. The all-in-one Startup path already supported DB_HOST/DB_ADMIN_USER/DB_ADMIN_PW overrides, but the compose files never passed them through and the distributed Dapr secret store ignored them entirely. - Add shared DatabaseConnectionStringHelper and use it in both the config-file and the Dapr secret-store connection string providers - Wire DB_HOST/DB_ADMIN_USER/DB_ADMIN_PW/DB_NAME through all compose files (all-in-one, traefik, distributed), mapped to POSTGRES_* for the database container - Add deploy/*/.env.example templates, gitignore real .env files - Document compose wiring, first-init semantics and local dev setup Defaults (postgres/admin/openmu) still apply when unset, so existing installations keep working without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the postgres admin credentials configurable through
DB_HOST,DB_ADMIN_USER,DB_ADMIN_PW(+DB_NAMEfor the database name) inevery deployment variant, instead of the hardcoded
postgres/admin.Why
The env override only worked on the all-in-one Startup code path, and even
there the compose files never passed the variables through
(
POSTGRES_PASSWORD: adminwas hardcoded and the app got noDB_ADMIN_PW).The distributed Dapr setup ignored the variables completely
(
secrets.json+ provider had no env support).Changes
DatabaseConnectionStringHelper, used by bothConfigFileDatabaseConnectionStringProviderandSecretStoreDatabaseConnectionSettingsProviderall-in-one,all-in-one-traefikincl. prod,distributed) readDB_*withadmin/postgres/openmudefaultsand map them to
POSTGRES_*for the database containerdeploy/*/.env.exampletemplates; real.env*files gitignored(templates stay committable)
docker.md,startup-parameters.md), env-based local dev flow (from-source.md,now Windows + Linux)
Backward compatibility
No action needed for existing installs: with no env set, everything
resolves to the previous defaults.
POSTGRES_PASSWORDonly seeds freshvolumes, so changing it never alters an existing database (documented).
Testing
dotnet buildRelease (ci=true): EntityFramework, Dapr.Common,Startup, 0 errors
docker compose configpasses for all 4 compose filesadmin/postgres) and custom render(single
DB_*source derives both sides), plus a live postgrescontainer login with generated credentials