Env vars

Last updated

Env vars are the settings an app gets, like DATABASE_URL. dudbox keeps them encrypted. A secret one is hidden in lists and masked in build logs.

The app gets a change on its next deploy: after you set or delete env vars, call POST .../redeploy once (see Deployments).

The examples use API=https://dudbox.com/api/v1 and AUTH="Authorization: Bearer $DUDBOX_TOKEN".

GET /api/v1/services/{project}/{service}/env

All env vars of a service. Secret values are null here.

{
  "env": [
    { "key": "LOG_LEVEL", "value": "info", "secret": false },
    { "key": "DATABASE_URL", "value": null, "secret": true }
  ]
}

GET /api/v1/services/{project}/{service}/env/{key}

One env var with its real value, also a secret one. dudbox logs each read of a value, with the token that read it.

curl -s $API/services/acme/shop/env/DATABASE_URL -H "$AUTH"
{ "key": "DATABASE_URL", "value": "postgres://…", "secret": true }

PUT /api/v1/services/{project}/{service}/env/{key}

Makes or changes an env var. secret is false if you leave it out. A name has letters, digits and _, and does not start with a digit. A value is at most 32 KB.

curl -s -X PUT $API/services/acme/shop/env/DATABASE_URL -H "$AUTH" -H 'content-type: application/json' \
  -d '{"value": "postgres://…", "secret": true}'

Answer: 200 with the env var (value is null for a secret).

DELETE /api/v1/services/{project}/{service}/env/{key}

Deletes an env var. Answer: 204, no body. A name that is not there gets 404.

This page as Markdown, for agents: /docs/api/env.md