Skip to main content
Environment variables give the agent and every command it runs access to values such as API keys, tokens, and service URLs. Use them when a tool, script, or test in your repo expects a value from the environment. Cake supports two scopes:
  • Organization variables apply to every session in your organization. Only users with the admin role can manage them.
  • Personal variables apply only to sessions you own.
When both scopes define the same key, your personal value overrides the organization value in your sessions.

Add a variable

  1. Go to Settings → User → Data Plane for a personal variable. For an organization variable, go to Settings → Organization → Data Plane.
  2. In the Environment Variables section, select Add Variable.
  3. Enter a Key and a Value.
  4. Toggle Secret on if the value is sensitive.
  5. Select Save.
Keys must start with a letter or underscore and contain only letters, digits, and underscores, up to 253 characters. Your personal Data Plane page also lists organization variables. A personal variable with the same key replaces the organization one in that list.

Import variables from a .env file

  1. In the Environment Variables section, select Import.
  2. Paste the contents of your .env file, then select Import.
  3. Review the parsed keys and values. Remove any you don’t want, and mark sensitive values as Secret.
  4. Select Save.
.env

Secret variables

Cake hides secret values once you save them. You can’t view a secret value in the UI again, but you can replace it with a new value. Secret and non-secret variables reach the session the same way. Cake sends them to the session over an authenticated internal connection when the session container starts. Values aren’t stored in the Kubernetes pod spec or in any volume that outlives the pod.

When changes take effect

Cake loads your variables each time a session container starts. New sessions get your current variables. A running session keeps the variables it started with until its container restarts.

Reserved names

Cake sets the following variables itself and ignores any variable you add with these names:
  • CAKE_SERVICE_ACCOUNT_TOKEN_FILE
  • CAKE_AUTH_PROXY_PORT
  • CONTROL_PLANE_URL
  • SESSION_ID
  • CAKE_VOLUME_AUTOSCALING_ENABLED