Skip to main content
There are two ways to define environment variables, in the env field in your App Configuration and with Secrets. Once the env variables and secrets are set up and defined in your compose.yaml, they’ll show up at runtime in your env context property. Only the env vars for the current environment are included — when running locally, only env.local values are injected; when deployed, only env.cloud values are injected. They are never merged together. If a secret has the same name as an env variable, the secret value takes precedence.

Example

Configure your app with environment variables in your compose.yaml
# compose.yaml
name: "my-app"
env: 
  local:
    MY_VAR: "foo"
    ANOTHER_VAR: "bar"
  cloud:
    MY_VAR: "boo"
    ANOTHER_VAR: "baz"
secrets:
  - MY_SECRET
tasks:
 - name: "task1"
   path: "./task1.ts"
Reference those env variables in your tasks
import { TaskContext } from "compose";

export async function main({ env }: TaskContext) {
  console.log(env.MY_VAR);
  console.log(env.ANOTHER_VAR);
  console.log(env.MY_SECRET);
}

logEvent

Add custom events to the audit log.

callTask

Trigger tasks from other tasks, creating composable workflows.