Manage variables and environments
Variables let you configure an app without rebuilding its image, so the same image can run with different settings in each environment. Set a variable on an app to configure that app. To reuse a value across apps, store it once as a shared variable in the environment and reference it from each app.
Set app variables
Section titled “Set app variables”Saving variables restarts the app, because a process reads its environment at startup.
- Open the app.
- Go to Variables.
- Add the variables in Editor. To paste
.envtext, select Raw. - Select Save.
orchard deploy env set <id> LOG_LEVEL=infoTo store a value as a secret, add --secret. To read pairs from a file, use --file.
An app can have up to 1,000 variables, and each value can be up to 64 KB. For files, use storage. For data, use a database.
Shared variables
Section titled “Shared variables”A shared variable belongs to an environment. An app receives a shared value only when one of its own variables references it.
Add a shared variable
Section titled “Add a shared variable”- Open the project.
- Go to Variables.
- Select the environment.
- In Shared variables, select Add variable.
- Enter the key and the value.
- Select Save.
orchard env vars set API_BASE_URL=https://api.example.comReference a shared variable
Section titled “Reference a shared variable”Set an app variable to a reference:
API_BASE_URL=${{shared.API_BASE_URL}}Orchard resolves references when it starts the pod and when it builds the image. If you change a shared value, Orchard updates and restarts only the apps whose values change.
Secrets
Section titled “Secrets”Orchard encrypts secret values at rest. You can replace a secret value, but you cannot read it back from the dashboard, the CLI, the API, or MCP.
Orchard passes a secret to the container through the app’s Kubernetes Secret. The pod spec holds a reference and not the value.
Reference a database or another app
Section titled “Reference a database or another app”To read a value from a database or another app, use a reference such as ${{resource.appdb.connection_string}}. To add one, select Use a resource in the value field. The available fields are listed in Connect an app to a database or app.
Create an environment
Section titled “Create an environment”Each project has a Production environment by default. Each new environment gets its own namespace.
- Open the project.
- Open the environment menu.
- Select New environment.
- Enter a name.
orchard env create --name stagingPull variables to a local file
Section titled “Pull variables to a local file”To match a cluster environment during local development, pull its variables:
orchard env pull stagingThe command writes the environment’s shared variables to .env.orchard. To change the path, use --out. To merge one app’s variables on top, use --deployment <id>.
Secret values are write-only, so the file contains commented placeholders for them. Fill these in locally.
Related resources
Section titled “Related resources”orchard envreference - Everyorchard envcommand and flag, includingorchard env pull.- Attach an Orchard project - Load an environment’s variables into a Greenhouse machine.
- Manage a project - Create, share, transfer, move, and delete projects.