---
title: Variables and secrets
description: Configure components with environment variables and files, set on a project, an environment or a single component, with secrets stored encrypted.
---

Kapten passes configuration to your components as **variables**. A variable is either:

- a **key/value** pair, exposed to the container as an environment variable;
- a **file**, mounted in the container at an absolute path you choose.

A **secret** is a variable whose value is stored in a secrets vault instead of the Engine's database. Once saved, a secret's value is never shown again, in the console or through the API: you can replace it, not read it.

## Where to set them

| Level | Applies to |
| --- | --- |
| Project | Every component of every environment of the project. |
| Environment | Every component of that environment. |
| Component | One application, job or database. |

Set shared settings, such as a log level, on the project, values that differ between staging and production on the environment, and anything specific to one service on the component.

Changing a variable takes effect at the component's next deployment.

## Database secrets

When you create a [database](/concepts/components#databases), Kapten adds its credentials to the environment as secrets named after the database. For a database named `main`:

| Secret | Value |
| --- | --- |
| `KAPTEN_DATABASE_MAIN_HOST` | Host name to connect to |
| `KAPTEN_DATABASE_MAIN_USERNAME` | User name |
| `KAPTEN_DATABASE_MAIN_PASSWORD` | Password |
| `KAPTEN_DATABASE_MAIN_DATABASE` | Database name |
| `KAPTEN_DATABASE_MAIN_CONNECTION_STRING` | Full connection URL |

The database name is upper-cased, and each run of characters other than letters and digits becomes a single `_`. These secrets are managed by Kapten: you cannot edit or delete them, and they are removed with the database.
