
# Environment variables

Environment variables belong to a service environment. This allows separate branches to use different endpoints, credentials, and feature settings.

## Add a variable

1. Open the service environment.
2. Select **Environment Variables**.
3. Add the key and value requested by your application.
4. Save the changes.
5. Redeploy when the application needs a new runtime with the updated values.

By default, saving variables redeploys the service. To make several changes first and deploy once, tick **Environment variables** in [Manage Autodeploy](/docs/guides/manage-autodeploy). Saved variables then wait for the **Deploy** button in the header.

The [health check path](/docs/guides/health-checks) is stored as the `KUBERNS_HEALTHCHECK_PATH` variable and is edited from **Settings → Advanced settings**.

## Recommended practices

- Keep secrets out of Git.
- Use distinct credentials for production and non-production environments.
- Match key names exactly, including case.
- Rotate credentials if they appear in logs or source history.
- Review template-required fields before deployment.

The AI agent can detect likely variable names, but it cannot supply credentials for external providers unless those values are provided through the deployment flow.
