Environment Variables Reference¶
All platform settings are configured via the .env file at the root of the project.
[!TIP] For a detailed guide on how to configure each section, generate secure secrets, and sync database roles, see the Environment Configuration (.env) Guide.
Complete .env Reference Table¶
| Variable | Default Value | Description |
|---|---|---|
DOMAIN |
example.com |
Base domain name for public production deployments. |
API_DOMAIN |
api.example.com |
Subdomain routed to the FastAPI Gateway by Traefik. |
MQTT_DOMAIN |
mqtt.example.com |
Subdomain routed to the Mosquitto broker by Traefik. |
ACME_EMAIL |
admin@example.com |
Contact email provided to Let's Encrypt for TLS expiry warnings. |
POSTGRES_DB |
iot |
Database name created inside PostgreSQL / TimescaleDB. |
POSTGRES_USER |
postgres |
Superuser account name for PostgreSQL. |
POSTGRES_PASSWORD |
(Required) | Superuser password for database initialization. |
PG_MQTT_AUTH_PASSWORD |
(Required) | Password for least-privilege role iot_mqtt_auth. |
PG_BRIDGE_PASSWORD |
(Required) | Password for least-privilege role iot_bridge. |
PG_API_PASSWORD |
(Required) | Password for least-privilege role iot_api. |
BRIDGE_MQTT_USER |
svc_bridge |
Internal service username used by Python Ingestion Bridge. |
BRIDGE_MQTT_PASSWORD |
(Required) | Password matching Bcrypt hash in db/init/03_roles.sql. |
API_MQTT_USER |
svc_api |
Internal service username used by FastAPI to forward HTTP writes. |
API_MQTT_PASSWORD |
(Required) | Password matching Bcrypt hash in db/init/03_roles.sql. |
JWT_SECRET |
(Required) | 32+ character cryptographic secret for signing user JWT tokens. |
JWT_ALGORITHM |
HS256 |
Algorithm used for JWT signatures. |
ACCESS_TOKEN_EXPIRE_MINUTES |
15 |
Expiry duration for user access tokens. |
REFRESH_TOKEN_EXPIRE_DAYS |
30 |
Expiry duration for persistent refresh tokens. |
Production Security Recommendations¶
- Rotate Secrets: Never use default passwords or default
JWT_SECRETin production. - Synchronize Role Hashes: If you change
BRIDGE_MQTT_PASSWORDorAPI_MQTT_PASSWORD, generate new Bcrypt hashes (cost 10) and updatedb/init/03_roles.sqlprior to first database initialization. - Restrict Docker Socket: Ensure
/var/run/docker.sockmounted into Traefik is protected and inaccessible from untrusted networks.