The Game Panel specification

ADR-0006: Environment variables are only read during bootstrap

Context

Some values the panel needs, such as secrets, come from environment variables, supplied either through the process environment or through a local env file. They are needed while the panel is being configured. Once it has been, nothing should depend on reading them directly.

Decision

Environment variables are held by Env, a static singleton initialised once during bootstrap from either the $_ENV superglobal or an env file, and it exists only during initial bootstrapping. Initialising it a second time, or reading from it before it has been initialised, throws, and its typed accessors throw when a value cannot be cast to the type requested. Code outside bootstrap does not read environment variables.

Alternatives

No alternatives were weighed.

Consequences

Easier:

Harder:

Constrained:

Sources