The service's environment variables are stored encrypted and go into the container on each deploy. You can write fixed values, reference variables from other services in the project and attach variable sets shared by the team.
Edit the service's variables
Open the service and go to the Variables tab. There are two editing modes, in the corner of the Environment variables card:
- List: one variable per row. To add one, type the NAME and the value and click Add. To change one, use the pencil; to delete it, the trash can.
- .env: the whole file, in
NAME=valueformat, one per line. Lines with#are ignored. Save all replaces everything: whatever is no longer in the text is removed.
NODE_ENV=production
APP_URL=https://loja.com.br
# Reference to the project database
DATABASE_URL=${{mysql.MYSQL_URL}}
Names accept uppercase letters, numbers and _. Values show blurred: click to see them.
NoteVariable changes apply from the next deploy. To apply them without a build, use Restart in the More actions menu of the live deploy. See Restart with the current variables.
Variables the panel sets
PORT: with the Port set in Settings, the container getsPORTwith that value, unless you setPORTin the variables.- The variables created along with the service (for example,
MYSQL_ROOT_PASSWORDandMYSQL_URLfor MySQL) show in the list and can be edited.
References between services
To use a value from another service in the project, write a reference in the value. When you type ${{ in the field, the panel suggests the services and variables.
| Reference | Value at deploy time |
|---|---|
${{NAME}} |
Another variable of the same service. |
${{mysql.MYSQL_URL}} |
The MYSQL_URL variable of the mysql service. |
${{redis.INFRA_HOST}} |
The internal address of the redis service (its internal name). |
${{redis.INFRA_PORT}} |
The port of the redis service. |
${{pg.DATABASE_URL}} |
A connection variable of the project's pg managed database. |
The prefix is the internal name of the service (or managed database), not its display name. It shows in Settings, under Internal address.
The value is built on the deploy of the service using it. If the MySQL password changes, the API's next deploy already gets the new connection URL. A reference can point to another one, up to 5 levels.
In the list, references show with the reference tag. If the referenced service doesn't exist in the project, service not found shows up, and the reference becomes empty text at deploy time.
NoteThe internal network connects services on the same server. A reference to
INFRA_HOSTof a service on another server won't connect.
Connect a database in a container to another service
In the Variables tab of a database in a container (MySQL, PostgreSQL, Redis, MongoDB), the Connect another service card builds the reference for you:
- Under Choose the service, select who will use the database (e.g.
api). - Click Add MYSQL_URL to it (for PostgreSQL,
DATABASE_URL; for Redis,REDIS_URL; for MongoDB,MONGO_URL). - Deploy the chosen service.
Automatic variables (legacy link)
Services linked to a managed database the old way get automatic variables at deploy time, without them showing in the list. They keep working. Under Automatic variables (legacy link), the Convert to variables button creates the same variables in the list, referencing the database. A variable in the list with the same name wins over the automatic one.
Shared variables
Variables that repeat across several services (SMTP, API keys, Sentry) can live in a team set.
Create a set
- In the menu, open Projects → Shared variables.
- Click New set, give it a name (e.g.
smtp) and, if you want, a description. - Click Create.
- On the set screen, write the variables in
NAME=valueformat and click Save.
Set variables also accept references such as ${{mysql.MYSQL_URL}}. They are resolved on the deploy of each service that uses the set.

Use a set in a service
- In the service's Variables tab, scroll down to Shared variables.
- Choose the set in Add set... and click Add.
- Adjust the order with Move up and Move down, and click Save.
When the same name shows up in more than one place:
- The lower set wins over the one above it.
- The service's own variable wins over all sets.
Under Inherited, the panel lists the names that come from the sets. A struck-through name is set on the service, and the service's value wins.

Change a set in use
After you save a set, the panel shows how many services use it. Click Restart all to start the live version of each one again, with no build, with the new variables.
To delete a set, first remove it from every service that uses it.
Who can view and edit
- People with the View variable values permission see the values. Without it, the panel shows only the names.
- People with Edit variables create, change and remove variables and sets.
From the CLI
The CLI reads and writes the variables of the service linked to the folder:
ployter env # list
ployter env pull .env # download to a file
ployter env set APP_DEBUG=false LOG_LEVEL=info
ployter env unset APP_DEBUGSee CLI.