Env
Env is Layeron’s application environment variable product. It is for non-secret runtime configuration such as API base URLs, feature flags, regions, modes, limits, and product tuning values.
Deployment isolation uses Layeron environments such as dev, preview,
staging, and prod. Env uses the selected deployment environment to choose
which values are active.
What Env Is For
Section titled “What Env Is For”Use Env for values that are safe to include in compiled app metadata:
- Public API base URLs.
- Feature flags.
- Runtime modes.
- Region names.
- Numeric limits.
- Product tuning values.
Use Secrets for sensitive values such as API keys, signing keys, provider tokens, and webhook secrets.
How It Fits
Section titled “How It Fits”Env is resolved once during project loading and stored in AppSpec.metadata.env.
Every runtime created from that app spec receives the same resolved values.
- App routes read Env through
layeronEnv(...)or theenv(...)alias. - Product Workers read Env through the same helper.
- Product-to-product calls keep using the active runtime context.
This makes Env global to the backend application while still following the selected deployment environment.
Next Steps
Section titled “Next Steps”- Get started: Define values in
layeron.config.ts, select an environment, and read values from runtime code. - Runtime values: Review string, number, boolean, and JSON readers plus the Env versus Secrets boundary.
- Secrets: Store sensitive runtime values through Secret references.