Services, depending on the type and attributes, export
environment variables that you can import within the env
configuration of another service.
The name of the exported variable follows the ${SERVICE_NAME}_${ATTRIBUTE}
pattern. Dashes -
,
in the service name, are converted to underscores _
and the exported environment variable name
is always uppercase.
If your config includes service names that are too similar, like blog-1
and blog_1
, which would result in a conflict
of exported environment variables, you’ll see
a validation error and you won’t be able to deploy such config.
All services, no matter the type and configuration, export their private hostname as ${SERVICE_NAME}_HOST
.
Services made public, in addition to their private hostname, also export public one as ${SERVICE_NAME}_PUBLIC_HOST
.
services:
# Exports:
# - WORKER_1_HOST
worker-1: {}
# Exports:
# - MY_BLOG_HOST
# - MY_BLOG_PUBLIC_HOST
my_blog:
public: true
Services of type postgres
and valkey
export database connection information, that other services can use to connect.
${SERVICE_NAME}_URL
- postgresql://
private connection string${SERVICE_NAME}_USER
- username${SERVICE_NAME}_PASSWORD
- password${SERVICE_NAME}_DB
- default database name${SERVICE_NAME}_URL
- redis://
private connection string${SERVICE_NAME}_USER
- username${SERVICE_NAME}_PASSWORD
- password${SERVICE_NAME}_DB
- default database numberservices:
rails:
env:
DATABASE_URL: $PRIMARY_DB_URL # exported by "primary_db" service
REDIS_URL: $MEMORY_DB_URL # exported by "memory_db" service
primary_db:
type: postgres
memory_db:
type: valkey