Skip to content

Environment Variables

Complete reference for environment variables used by Tunnet components.

Service URL bindings

These three URLs are the only service bindings you need to configure. Set them in the repository root .env for local development.

VariableDescriptionExample
DASHBOARD_URLDashboard origin (CORS, OAuth redirects, SSH browser auth)http://localhost:5173
MANAGEMENT_URLManagement API public URL (auth, REST API, CLI login)http://localhost:3000
CONTROL_PLANE_URLControl plane URL (agent enroll, relay register)http://localhost:8080

The management server derives the control plane admin API URL from CONTROL_PLANE_URL (same host, port 9091).

Secrets

VariableDescriptionExample
DATABASE_URLPostgreSQL connection stringpostgres://user:pass@localhost:5432/tunnet
BETTER_AUTH_SECRETAuth signing secret (32+ chars)a-long-random-string-at-least-32-characters
TUNNET_SERVICE_SECRETInternal API shared secret (management ↔ control)a-long-random-string-at-least-32-characters

Agent (tunnet)

VariableDescriptionExample
TUNNET_STATE_DIRAgent state directory~/.local/state/tunnet
CONTROL_PLANE_URLControl plane URL (--control-url)http://127.0.0.1:8080
MANAGEMENT_URLManagement API URL (tunnet login)http://localhost:3000
TUNNET_ENROLL_TOKENEnrollment tokeneyJ...
TUNNET_ORG_SLUGOrganization slug (quick enroll)my-company
TUNNET_HOSTNAMEMachine hostnameapi-prod
TUNNET_IFNAMETUN interface nametunnet0
TUNNET_POLL_SECSSnapshot poll interval30
TUNNET_METRICS_BINDPrometheus metrics bind127.0.0.1:9100
TUNNET_DISABLE_GOSSIPDisable gossiptrue
TUNNET_RECORDEREnable SSH recordingtrue
TUNNET_JSON_LOGSJSON log formattrue

Control plane internals

VariableDescriptionDefault
TUNNET_BINDPublic API bind address0.0.0.0:8080
TUNNET_ADMIN_BINDInternal admin API bind127.0.0.1:9091
TUNNET_INTERNAL_BINDMetrics/ready bind127.0.0.1:9090

Released under the AGPL-3.0 License.