feat(oci): runtime config injection via entrypoint #21
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/runtime-config-injection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lets self-hosters point the SPA at their own API + OIDC issuer without rebuilding the image. The container entrypoint generates /usr/share/caddy/_mokosh_config.js at start from env vars (MOKOSH_API_BASE, MOKOSH_OIDC_ISSUER, MOKOSH_OIDC_CLIENT_ID, MOKOSH_HUB_BASE_URL), injects a
Lets self-hosters point the SPA at their own API + OIDC issuer without rebuilding the image. The container entrypoint generates /usr/share/caddy/_mokosh_config.js at start from env vars (MOKOSH_API_BASE, MOKOSH_OIDC_ISSUER, MOKOSH_OIDC_CLIENT_ID, MOKOSH_HUB_BASE_URL), injects a <script> tag into index.html on first run, then execs Caddy. The SPA reads window.__MOKOSH_CONFIG__ first; if a field is absent it falls through to the existing msp.<tld> host-prefix derivation, then to the compile-time option_env! defaults. In dev (no entrypoint, no window global) every reader returns None so behaviour is unchanged. The Caddyfile no-cache rule was extended to cover /_mokosh_config.js so operator changes take effect on container restart. The Caddyfile COPY's previous --chmod=0644 was reverted because BuildKit propagates that mode to implicitly-created parent dirs (the /etc/caddy dir would land at 0644 with no execute bit, blocking appuser from traversing it); an explicit `RUN mkdir --parents /etc/caddy` is now done up front. Smoke-tested: container with no env exposes window.__MOKOSH_CONFIG__ = {}; container with all four env vars set exposes the matching fields; restarting with a different MOKOSH_API_BASE updates the served JS on the next request. Signed-off-by: nrupard <natrsmith11@gmail.com>