fix(infra): pass pgweb credentials via discrete CLI flags #63

Merged
julien merged 1 commits from fix/infra/pgweb-cli-flags into main 2026-05-08 23:13:18 +02:00
Owner

Summary

PGWEB_DATABASE_URL (post-#62 rename) still fails at boot:

Error: Invalid URL. Valid format: postgres://user:password@host:port/db?sslmode=mode

Root cause: the userinfo portion of a Postgres URL must be URL-encoded — any @, #, :, /, ?, %, &, =, +, ; etc. in the password breaks the parser. Compose has no built-in URL encoding, so the URL we construct in YAML is fragile by design and depends on the developer happening to pick a URL-safe password.

Switch to pgweb's discrete CLI flags (--host, --port, --user, --pass, --db, --ssl). Compose interpolates each value literally — no URL encoding required, any password works.

The image's ENTRYPOINT already passes --bind=0.0.0.0 --listen=8081; our args are appended to those.

Side benefit

A missing password now yields an explicit Compose error (POSTGRES_PASSWORD must be set in infra/local/.env) rather than an opaque pgweb crash with a vague "Invalid URL" message.

Test plan

  • After merge: docker compose -f infra/local/dev.compose.yml --profile dbtools up -d → pgweb stays up (no Restarting (1) loop).
  • http://localhost:8081 loads pgweb's UI; you can navigate to the audit schema.
  • Confirm with a password that contains a special char (e.g., dev@pass#2026!) — should still work.
## Summary `PGWEB_DATABASE_URL` (post-#62 rename) still fails at boot: ``` Error: Invalid URL. Valid format: postgres://user:password@host:port/db?sslmode=mode ``` Root cause: the userinfo portion of a Postgres URL must be URL-encoded — any `@`, `#`, `:`, `/`, `?`, `%`, `&`, `=`, `+`, `;` etc. in the password breaks the parser. Compose has no built-in URL encoding, so the URL we construct in YAML is fragile by design and depends on the developer happening to pick a URL-safe password. Switch to pgweb's discrete CLI flags (`--host`, `--port`, `--user`, `--pass`, `--db`, `--ssl`). Compose interpolates each value literally — no URL encoding required, any password works. The image's ENTRYPOINT already passes `--bind=0.0.0.0 --listen=8081`; our args are appended to those. ## Side benefit A missing password now yields an explicit Compose error (`POSTGRES_PASSWORD must be set in infra/local/.env`) rather than an opaque pgweb crash with a vague "Invalid URL" message. ## Test plan - [ ] After merge: `docker compose -f infra/local/dev.compose.yml --profile dbtools up -d` → pgweb stays up (no `Restarting (1)` loop). - [ ] http://localhost:8081 loads pgweb's UI; you can navigate to the `audit` schema. - [ ] Confirm with a password that contains a special char (e.g., `dev@pass#2026!`) — should still work.
julien added 1 commit 2026-05-08 23:13:02 +02:00
fix(infra): pass pgweb credentials via discrete CLI flags
CI / commits (pull_request) Successful in 1m11s
CI / check (pull_request) Successful in 1m20s
CI / scan (pull_request) Successful in 1m23s
CI / a11y (pull_request) Successful in 1m29s
CI / perf (pull_request) Successful in 3m15s
1ab8bfb212
`PGWEB_DATABASE_URL` (post-#62 rename) still failed at boot with:

    Error: Invalid URL. Valid format:
    postgres://user:password@host:port/db?sslmode=mode

The userinfo portion of a Postgres URL must be URL-encoded —
any `@`, `#`, `:`, `/`, `?`, `%`, `&`, `=`, `+`, `;` etc. in the
password breaks the parser. Compose has no built-in URL encoding,
so the URL we construct in YAML is fragile by design.

Switch to pgweb's discrete CLI flags (`--host`, `--port`, `--user`,
`--pass`, `--db`, `--ssl`). Compose interpolates each value
literally — no URL encoding required, any password works. The
image's ENTRYPOINT already passes `--bind=0.0.0.0 --listen=8081`;
our args are appended to those.

Side benefit: the failure mode for a missing password is now an
explicit Compose error
(`POSTGRES_PASSWORD must be set in infra/local/.env`) rather than
an opaque pgweb crash.
julien merged commit 171f21b99b into main 2026-05-08 23:13:18 +02:00
julien deleted branch fix/infra/pgweb-cli-flags 2026-05-08 23:13:21 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: julien/apf_portal#63