feat: add DIFY_DB_USER/DIFY_DB_PASS env overrides for per-service DB credentials#34753
Closed
lin-snow wants to merge 1 commit into
Closed
feat: add DIFY_DB_USER/DIFY_DB_PASS env overrides for per-service DB credentials#34753lin-snow wants to merge 1 commit into
lin-snow wants to merge 1 commit into
Conversation
…FY_DB_USER and DIFY_DB_PASS
Contributor
Pyrefly DiffNo changes detected. |
Contributor
|
I would suggest implementing this in orchestration layer. Will close this for now. |
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.
Important
Fixes #<issue number>.Summary
Fixes #34752
resolves ENG-164
Add
DIFY_DB_USERandDIFY_DB_PASSas optional environment variable overrides forDB_USERNAMEandDB_PASSWORD.Why: Docker Compose cannot do per-service variable fallback inside a shared YAML anchor (
x-shared-env). To support per-service DB credentials (e.g. least-privilege access), the fallback must happen in application code.What changed (
api/configs/middleware/__init__.py):DIFY_DB_USER/DIFY_DB_PASS(defaultNone).effective_db_username/effective_db_passwordcomputed properties that prefer the new vars when set, falling back to the originals.SQLALCHEMY_DATABASE_URIto use the effective values.No breaking change — unset vars fall back to existing
DB_USERNAME/DB_PASSWORD.Screenshots
N/A (backend config only, no UI change)
Checklist
make lintandmake type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods