Skip to content

fix(dev): read RPID from the environment in the dev stack - #237

Merged
Bccorb merged 1 commit into
mainfrom
fix/dev-rpid-and-config-cache
Aug 31, 2026
Merged

fix(dev): read RPID from the environment in the dev stack#237
Bccorb merged 1 commit into
mainfrom
fix/dev-rpid-and-config-cache

Conversation

@Bccorb

@Bccorb Bccorb commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Closes #142.

The bug

docker-compose.dev.yml set RPID: localhost as a literal while every neighbouring value takes an override (ORIGINS, FRONTEND_URL, APP_ORIGINS). Compose gives environment: precedence over env_file:, so setting RPID in .env was silently ignored and editing the compose file was the only way through. Now ${RPID:-localhost}.

Verified both directions: RPID=example.test docker compose config resolves to example.test, and unset still resolves to localhost.

The two other bullets

Both turned out to be already handled, so this reports rather than changes them.

Cache invalidation on admin writes already happens. invalidateSystemConfigCache() is called by the whole-config PATCH (systemConfig.ts) and by the per-provider routes (oauthProviders.ts), and there are tests asserting it on both. No change needed.

The re-seed is already documented in docs/configuration.md under Environment vs system_config, including the updatedBy IS NULL precedence and the warn log on overwrite.

What that section did not cover is the case the issue actually hit, so this adds it: a row edited directly in the database keeps updatedBy NULL, so it still counts as env-driven and the next boot reverts it to the environment variable. The value reads back correctly from the database right up until the process restarts, which is why this looks like the edit silently failed. Direct edits also miss the cache invalidation the admin routes do, so they are additionally invisible for up to five minutes.

Also tightened the closing line of that section, which said a write "should" invalidate the cache. The write paths do; a direct database edit does not.

Verification

docker compose config interpolation checked both ways. Full gate green via the pre-commit hook: lint, format, typecheck, 1194 tests, coverage, build. Local dev only, no runtime source change, so no changeset.

docker-compose.dev.yml hardcoded RPID: localhost while every neighbouring value
takes an override. Compose gives environment: precedence over env_file, so
setting RPID in .env had no effect and the only way to change it was editing the
compose file. Changing the relying party for mobile work then surfaced as an
Android "RP ID cannot be validated", which points nowhere near the cause.

Also documents the case that made this hard to diagnose: a row edited directly
in the database keeps updatedBy NULL, so it still counts as env-driven and the
next boot reverts it. The value reads back correctly until the process restarts.

The issue also asked whether admin writes should invalidate the config cache.
They already do, in both the whole-config PATCH and the per-provider routes,
each with a test. The docs said a write "should" invalidate; they now say the
write paths do, and that a direct database edit does not.
@Bccorb
Bccorb merged commit 751ed8e into main Aug 31, 2026
5 checks passed
@Bccorb
Bccorb deleted the fix/dev-rpid-and-config-cache branch August 31, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dev compose hardcodes RPID and system config re-seeds on boot

1 participant