Read local Postgres settings from the assembled env, not process.env - #164
Open
16francej wants to merge 2 commits into
Open
Read local Postgres settings from the assembled env, not process.env#16416francej wants to merge 2 commits into
16francej wants to merge 2 commits into
Conversation
The supervisor is spawned with only the caller's env; dev.env is merged into assembled.env later by assembleEnv(). ensureLocalPostgres() read DEV_INSTANCE_POSTGRES_* from process.env, so a port/container/password configured in dev.env never reached it — it defaulted to 55432 and, on a machine where that port belongs to a different Postgres container, up failed with 'password authentication failed for user postgres'. Thread the assembled env through instead.
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.
Problem
dev-instance upfailed withcould not connect to DATABASE_URL: password authentication failed for user \"postgres\"on a machine whose~/.config/qm/dev.envsetsDEV_INSTANCE_POSTGRES_PORT=55433.The CLI spawns the supervisor with only the caller's env (
scripts/dev/cli.ts); dev.env is merged intoassembled.envlater byassembleEnv(). ButensureLocalPostgres()readDEV_INSTANCE_POSTGRES_*fromprocess.env, so dev.env settings never reached it. It defaulted to port 55432 — which on this machine belongs to a different Postgres container with a different password — while theqm-dev-postgrescontainer name check passed, producing the misleading auth failure.Fix
ensureLocalPostgres()takes the env record and the supervisor passesassembled.env(which already layers caller env over dev.env). No default-to-process.envfallback, so the resolution order is single-sourced.Verified
main):upfails as above unlessDEV_INSTANCE_POSTGRES_PORT=55433is exported manually.upboots clean with no manual export — canary round-trips, core runsstore=postgresagainst the dev.env-configured container. Torn down after.dev-cli-libanddev-supervisor-childtests, typecheck, lint, format all pass.Found while live-QAing #160.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.