Before you begin
- A Forge project whose
prodenvironment is bound to Reliant hosting. Deploy a Go API with managed Postgres or Deploy an existing app from its Dockerfile gets you there. This guide uses a small Node API adopted with--kind app. - The admin role in the organization, or an automation token with
secret:write(who can set a secret). - Billing on the organization for the deploy step. Setting a secret needs no billing and starts nothing.
- Forge v1.6.1 or later (
reliant forge --versioninside the project).
1
Declare the secret once
Name the variable and say it comes from the environment’s store. In an adopted app that is In a Forge Go API, mark the config field
forge.ManagedSecret in deploy/kcl/workloads.k, which every environment imports:deploy/kcl/workloads.k
sensitive: true instead (Configuration). A workload receives only the secrets it declares.2
Set the dev value in the local file store
Dev’s The file is mode
main.k declares secret_provider = forge.FileSecrets {path = "secrets/dev.yaml"}. secret set reads the value from stdin and writes it there:terminal
Output (trimmed)
0600 and gitignored, so dev values never reach git. reliant forge env up dev hands each process the values it declares.3
Set the prod value in the hosted store
The same command with Pipe from your password manager’s CLI rather than typing the value; there is no flag that takes it. Before a prod deploy,
--env prod writes to the hosted store instead. It works before the first deploy and creates the environment record on first write:terminal
Output
secret list --env prod is the check: a declared name shows MISSING until it is set, and a deploy that needs it fails.4
Confirm nothing reads it back
There is no command that returns a hosted value, and The store refuses reads below the CLI too (Hosted secrets are write-only). Keep your own copy of anything you cannot regenerate.
env exec refuses hosted workloads:terminal
Output
5
Deploy and verify the app receives it
Deploy, then ask the app whether the variable is set. The sample endpoint returns a boolean and the first 8 hex characters of the value’s SHA-256, never the value:
terminal
Output (trimmed)
6
Rotate the value
Setting an existing name writes a new version. That is rotation; there is no separate command:The running app answered with the new fingerprint about 15 seconds after the write, with no deploy: the platform rolls the workloads that read a changed secret. Rotate at the source first (issue the new key at the provider), set it here, then revoke the old key once the new fingerprint answers.
terminal
Output
An environment marked protected asks an admin for an emailed one-time code before any value changes, and an automation token cannot change it at all. The security model explains the step-up; it was not exercised in this guide’s run.
What this does not do
- It does not show or recover a value. A lost value is rotated at its source.
- It does not share values between environments. Staging and prod each need their own
secret set. reliant forge env secrets verifyis not a check for hosted secrets. It compares Secrets in your own Kubernetes cluster with an external store during a move to External Secrets, and on a hosted env it printsthe env declares no store-backed ExternalSecret (forge.StoreSource): there is nothing to verify. Usesecret listinstead.
Troubleshooting
unknown flag: --env
unknown flag: --env
You ran a
secret subcommand that does not exist, such as secret get --env prod NAME. The subcommands are set, unset, list, ensure, import, migrate, allow, deny and access; none returns a value.PAYMENTS_API_KEY MISSING
PAYMENTS_API_KEY MISSING
The name is declared but nothing is stored for that environment. Set it with
secret set --env <env>, then deploy.Next steps
Add a custom domain with HTTPS
Serve the same prod environment on a hostname you own.
Secrets
Versions, delete versus destroy, and the console’s Secrets page.
Security model
Why values are write-only, and how step-up and workflow access lists work.
Custom domains
The domain and binding model behind
forge cloud domain.