Skip to content

Environment Variables

This page provides a comprehensive reference for all environment variables used to configure Terrateam Self-Hosted.

These environment variables are required for Terrateam Self-Hosted to function properly:

VariableDescriptionExample
DB_HOSTDatabase host addresslocalhost, db.example.com
DB_NAMEDatabase nameterrateam
DB_USERDatabase usernameterrateam
DB_PASSDatabase passwordsecure_password_123
DB_PORTDatabase port5432

Required when using GitHub as your VCS provider:

VariableDescriptionExample
GITHUB_APP_IDGitHub application ID123456
GITHUB_APP_CLIENT_IDGitHub application client IDIv1.8ea942184ee41c0b
GITHUB_APP_CLIENT_SECRETGitHub application client secret8dab6d1de78a2cdbc9o014dubcf4a55ca44a3c81
GITHUB_APP_PEMGitHub application private key (PEM format)-----BEGIN RSA PRIVATE KEY-----\nMIIE...
GITHUB_WEBHOOK_SECRETGitHub webhook secret for security02d87878a0ac61d75d25cz8fec1d1af509f9a6d9

Required when using GitLab as your VCS provider:

VariableDescriptionExample
GITLAB_APP_IDGitLab application IDabc123def456
GITLAB_APP_SECRETGitLab application secretgloas-1234567890abcdef
GITLAB_ACCESS_TOKENGitLab personal access tokenglpat-xxxxxxxxxxxxxxxxxxxx
VariableDescriptionExample
TERRAT_API_BASEPublic-facing API base URL (includes /api)https://terrateam.example.com/api
TERRAT_WEB_BASE_URLPublic-facing web base URLhttps://terrateam.example.com
TERRAT_UI_BASEPublic-facing UI base URL (required for UI)https://terrateam.example.com

These environment variables provide additional configuration options:

For GitHub Enterprise Server deployments:

VariableDescriptionDefaultExample
GITHUB_API_BASE_URLGitHub API base URLhttps://api.github.comhttps://api.github.example.com
GITHUB_WEB_BASE_URLGitHub web base URLhttps://github.comhttps://github.example.com

For self-hosted GitLab instances:

VariableDescriptionDefaultExample
GITLAB_API_BASE_URLGitLab API base URLhttps://gitlab.com/apihttps://gitlab.example.com/api
GITLAB_WEB_BASE_URLGitLab web base URLhttps://gitlab.comhttps://gitlab.example.com

For environments requiring HTTP proxies:

VariableDescriptionExample
HTTP_PROXYURL for HTTP proxyhttps://proxy.local:8080
HTTPS_PROXYURL for HTTPS proxyhttps://proxy.local:8080
NO_PROXYComma-separated list of hosts to bypass proxylocalhost,127.0.0.1,internal.com

For proxies requiring authentication, include credentials in the URL:

Terminal window
HTTP_PROXY=https://username:password@proxy.local:8080
HTTPS_PROXY=https://username:password@proxy.local:8080

For environments that use a private Certificate Authority (such as a corporate TLS-inspecting proxy, a self-hosted GitHub Enterprise Server with an internal CA, or a private artifact registry), Terrateam can install additional trusted CA certificates into the container’s trust store at startup.

VariableDescriptionExample
CUSTOM_CA_CERTOne or more PEM-encoded CA certificates to install into the container’s system trust store-----BEGIN CERTIFICATE-----\nMIID...\n-----END CERTIFICATE-----

When CUSTOM_CA_CERT is set, Terrateam parses every -----BEGIN CERTIFICATE----- / -----END CERTIFICATE----- block from the value, writes each one to /usr/local/share/ca-certificates/, and runs update-ca-certificates so the certificates are trusted system-wide inside the container. Any existing custom certificates installed by a previous startup are removed first, so the variable always reflects the full set of custom CAs you want trusted.

If CUSTOM_CA_CERT is not set, no custom certificates are installed and Terrateam starts up normally using only the certificates baked into the image.

Terminal window
CUSTOM_CA_CERT="-----BEGIN CERTIFICATE-----
MIIDdz...long base64 body...
-----END CERTIFICATE-----"

Concatenate the PEM blocks. Terrateam splits them apart automatically:

Terminal window
CUSTOM_CA_CERT="-----BEGIN CERTIFICATE-----
MIID...root CA...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIE...intermediate CA...
-----END CERTIFICATE-----"

When using Docker Compose, load the certificate from a file on the host:

services:
terrat:
image: ghcr.io/terrateamio/terrat:latest
environment:
CUSTOM_CA_CERT: ${CUSTOM_CA_CERT}
Terminal window
export CUSTOM_CA_CERT="$(cat /path/to/your-ca-bundle.pem)"
docker compose up -d

Only PEM-format certificates are supported. DER-encoded certificates must be converted first:

Terminal window
openssl x509 -inform DER -in your-ca.der -out your-ca.pem

For troubleshooting configuration issues, see the Troubleshooting Guide.