@easygov/react-components 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,6 +38,41 @@ Icons are available from a dedicated subpath (requires `./styles.css` to be load
38
38
  import { ArrowRight } from "@easygov/react-components/icons";
39
39
  ```
40
40
 
41
+ ## EasygovHeader configuration
42
+
43
+ `EasygovHeader` auto-detects Core and Keycloak URLs on `*.easygov.swiss` hostnames.
44
+ On any other host (localhost, adesso dev cluster review apps, CI), set these
45
+ `NEXT_PUBLIC_*` env vars in the consuming app:
46
+
47
+ | Variable | Required | Notes |
48
+ | --- | --- | --- |
49
+ | `NEXT_PUBLIC_CORE_ORIGIN` | Yes | Core frontend base URL, used for dashboard links. |
50
+ | `NEXT_PUBLIC_CORE_API_ORIGIN` | No | Core API base URL. Defaults to `NEXT_PUBLIC_CORE_ORIGIN`; only needed when the API runs on a different origin (e.g. a different port on localhost). |
51
+ | `NEXT_PUBLIC_OIDC_AUTHORITY` | Yes | **Full** Keycloak authority URL including the realm path, e.g. `https://keycloak.example.com/auth/realms/easygov`. |
52
+
53
+ If `NEXT_PUBLIC_CORE_ORIGIN` or `NEXT_PUBLIC_OIDC_AUTHORITY` is missing on a
54
+ non-`easygov.swiss` host, the header degrades gracefully (auth disabled, no API
55
+ calls) and logs a warning in development.
56
+
57
+ **These vars must be present when your app is *built*, not just when its
58
+ container starts.** Next.js inlines `NEXT_PUBLIC_*` values into the client
59
+ bundle at `next build` time — setting them only as a Kubernetes/container
60
+ runtime env var has no effect on an already-built bundle. If you build a
61
+ Docker image, pass them as build args and set them before the `next build`
62
+ step:
63
+
64
+ ```dockerfile
65
+ ARG NEXT_PUBLIC_OIDC_AUTHORITY
66
+ ARG NEXT_PUBLIC_CORE_ORIGIN
67
+ ENV NEXT_PUBLIC_OIDC_AUTHORITY=$NEXT_PUBLIC_OIDC_AUTHORITY
68
+ ENV NEXT_PUBLIC_CORE_ORIGIN=$NEXT_PUBLIC_CORE_ORIGIN
69
+ RUN next build
70
+ ```
71
+
72
+ and pass `--build-arg NEXT_PUBLIC_OIDC_AUTHORITY=...` (or the equivalent in
73
+ your CI pipeline) when building the image — not only in the Deployment spec
74
+ that runs it.
75
+
41
76
  ## License
42
77
 
43
78
  MIT