feat(config): assemble Postgres DB from component env vars - #47
Merged
Conversation
Add a component branch to the DB selection in config/settings.py between DATABASE_URL and the SQLite default. When PANDDA_DB_HOST is set, build the Postgres config from PANDDA_DB_* parts so the password arrives as its own env var (a Container App secretRef -> Key Vault reference) instead of being baked into a full-URL secret. Precedence: DATABASE_URL > PANDDA_DB_* > SQLite. Fully backward compatible: desktop/SQLite and DATABASE_URL deploys are unchanged. No new deps (psycopg already present). Document the new vars in docs/CLOUD_DEPLOYMENT.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Adds a component branch to the DB selection in config/settings.py between
DATABASE_URLand the SQLite default. WhenPANDDA_DB_HOSTis set, the Postgres config is assembled fromPANDDA_DB_*parts so the password arrives as its own env var — a Container AppsecretRef→ Key Vault reference to the existingdatabase-admin-password— instead of being baked into a full-URL secret. No full-URL secret is minted and no credential lands in a file or inaz ... showoutput.Precedence:
DATABASE_URL→PANDDA_DB_*(selected byPANDDA_DB_HOSTpresence) → SQLite.Vars
PANDDA_DB_HOSTPANDDA_DB_USERPANDDA_DB_PORT5432PANDDA_DB_NAMEreinspectPANDDA_DB_PASSWORD""PANDDA_DB_SSLMODErequireNotes
DATABASE_URLdeploys see no change.psycopgalready present in the image.server_main.pyrunsmigrateon start, so a fresh Postgres self-migrates (tables only — the database must already exist on the server; deployment ensures that).🤖 Generated with Claude Code