Environment variables and secrets

Each project has one set of environment variables. Every value is treated as a secret: it is encrypted at rest, hidden in the dashboard, and only sent to your server when a deployment starts.

Add variables

  1. Open the project and find Environment variables.
  2. Enter a KEY and a value, then click Add / update. Using an existing key replaces its value.
  3. Redeploy the project. Changes apply on the next deploy, not to the running container.

Keys must start with a letter or underscore and contain only letters, digits and underscores (up to 128 characters).

Import a .env file

Click Import .env, paste the file's contents, and click Import (overwrites same keys). Keys that already exist get the new value; other keys are left alone.

View and remove values

Values show as ••••••••. Click Reveal to see one. You may be asked for your password first, and every reveal is recorded in the audit log. Click Remove to delete a variable.

Reference other values

A value can refer to another variable or to a database's connection URL:

API_URL=https://${{ HOST }}/api
DATABASE_URL=${{ db.main.url }}

${{ db.<name>.url }} only works for a database on the same server as the project. A reference that doesn't resolve is rejected when you save. The database page can also set DATABASE_URL for you (see Databases).

How values reach your app

  • Values are passed to the container as environment variables at runtime. They are not available during docker build.
  • Cron jobs run with the same variables as the live app.
  • Pull request previews get no variables unless you turn on Share environment variables with previews for the project.
  • CI steps only get the variables they list under secrets: in .vpsm.yml.

How they are stored

Each organization has its own data key, protected by a key management service. Values are encrypted with AES-256-GCM before they are written to our database. See Security for details.