feat: palette and light/dark from go-bananas, and fix the image user
The theme selector and the appearance toggle are the custom elements go-bananas ships, loaded at run time. They are custom elements rather than components written here because the applications this service feeds are a mix of React, vanilla JavaScript and server-rendered HTML, and a custom element is the one shape all three can use with no build step, no import map, and no second copy of React to break the hooks. Every token in the stylesheet is now written as var(--bn-*, fallback). That ordering is the safety property: with no theme service configured the page renders exactly as it did before, and with one configured the same rules follow the palette. The navigation rail takes the contract's sunken surface and its paired foreground rather than a fixed dark navy, because a light appearance wants dark text there. THEME_BASE_URL is read from runtime-config.js, which the entrypoint rewrites from the environment on start, so one image serves every environment rather than baking a hostname into the bundle at build time. contract.test.ts fetches the live contract and asserts it defines every --bn-* variable this application consumes. A token renamed on the service would otherwise leave every var() resolving to its fallback, and the page would look correct while never actually following the palette. Verified it fails on a deliberately wrong token name. The image also had two USER lines, the second silently replacing the first with a uid that owns neither /app nor /tmp/nginx. nginx could not create its pid file or its temp paths, so the container failed to start. Confirmed by building both variants: the old one cannot write nginx's temp directory, the fixed one serves the front end, its hashed assets, and the /api proxy.
This commit is contained in:
parent
5449cd3d8d
commit
0a78c98cc6
19 changed files with 456 additions and 35 deletions
15
README.md
15
README.md
|
|
@ -212,6 +212,21 @@ The `Dockerfile` at the repository root still builds one combined image that
|
|||
serves both halves on port `8080`. It is convenient for local runs and browser
|
||||
BDD tests, while Kubernetes deploys the two images separately.
|
||||
|
||||
That combined image runs as the `app` user, which owns everything the runtime
|
||||
writes to. There is deliberately only one `USER` line: a second one silently
|
||||
replaced it with a uid owning neither `/app` nor `/tmp/nginx`, and nginx could
|
||||
then not create its pid file or its temp paths, so the container failed to start.
|
||||
nginx ignores its own `user` directive when the master is not root, so its
|
||||
workers run as whoever this names.
|
||||
|
||||
`THEME_BASE_URL` points the page at the [go-bananas](https://github.com/urpi/go-bananas)
|
||||
design-token service, which supplies the palette and the light/dark switch at run
|
||||
time. It is optional and empty by default, so an image without a theme service
|
||||
renders exactly as before. The entrypoint writes it into `runtime-config.js` on
|
||||
every start, so one image serves every environment. See
|
||||
[the front-end README](frontend/README.md#theming) for the deployment
|
||||
requirements.
|
||||
|
||||
Pushes to `master` publish `go-guess:latest` and `go-guess:<commit-sha>` to the
|
||||
private registry configured in `.github/workflows/publish-image.yml`. The
|
||||
repository must provide `REGISTRY_USERNAME` and `REGISTRY_PASSWORD` secrets.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue