Variables
Set environment variables and secrets, and reference other services.
Variables are injected into the service at deploy. Changes are saved immediately and take effect on the next deploy.
List
/containers/services/{serviceId}/variables{
"success": true,
"data": [
{ "key": "DATABASE_URL", "value": null, "secret": true, "fromTemplate": true },
{ "key": "NODE_ENV", "value": "production", "secret": false, "fromTemplate": false },
{ "key": "STRIPE_KEY", "value": null, "secret": true, "fromTemplate": false }
]
}Secret values are never returned
value is null for secrets. A variable is treated as secret when it was marked secret, when its name looks like a credential (PASSWORD, SECRET, TOKEN, API_KEY, *_KEY, DSN, ...), or when its value is a URL with a password in it. You can always overwrite a secret; you just can't read it back.
Set (create or update)
/containers/services/{serviceId}/variablesProp
Type
curl -X PUT https://api.helipod.io/api/containers/services/$SERVICE/variables \
-H "Authorization: Bearer hel_your_key" -H "Content-Type: application/json" \
-d '{
"variables": { "NODE_ENV": "production", "STRIPE_KEY": "sk_live_xxx", "DATABASE_URL": "${{Postgres.DATABASE_URL}}" },
"secrets": ["STRIPE_KEY"]
}'The response is { "variables": [ ... ], "needsRedeploy": true }.
Delete
/containers/services/{serviceId}/variables/{key}Shared variables
A project can hold shared variables: values that several services use, set once. A service reads one with a reference, ${{shared.KEY}} (see below). Changes take effect when each service that uses it is deployed again.
/containers/projects/{projectId}/variables{
"success": true,
"data": [
{ "id": "0c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f", "key": "SENTRY_DSN", "value": null, "secret": true },
{ "id": "5a6b7c8d-9e0f-4a1b-8c2d-3e4f5a6b7c8d", "key": "SUPPORT_EMAIL", "value": "[email protected]", "secret": false }
]
}/containers/projects/{projectId}/variablesThe body is the same as for a service: variables (up to 100 per project) and an optional secrets list. Secret values are never returned, and a variable that is secret stays secret.
curl -X PUT https://api.helipod.io/api/containers/projects/$PROJECT/variables \
-H "Authorization: Bearer hel_your_key" -H "Content-Type: application/json" \
-d '{ "variables": { "SENTRY_DSN": "https://[email protected]/1" }, "secrets": ["SENTRY_DSN"] }'The response is { "variables": [ ... ], "needsRedeploy": true }.
/containers/projects/{projectId}/variables/{key}{ "key": "...", "deleted": true, "needsRedeploy": true }, or 404 VARIABLE_NOT_FOUND.References
A value can point at another service in the same environment. The reference is resolved at every deploy, so it follows the other service when it changes.
| Write | Gets |
|---|---|
${{Postgres.DATABASE_URL}} | The DATABASE_URL variable of the service named Postgres |
${{Postgres.HELIPOD_PRIVATE_DOMAIN}} | The private host name of Postgres, reachable only inside the environment |
${{shared.KEY}} | A shared variable of the project |
${{KEY}} | Another variable of the same service |
${{secret(32)}}, ${{uuid}} | A random value, generated once when the variable is created |
Services that reference each other are connected on the dashboard canvas, and a service waits for the services it references when they start together.