--- id: environment_variables title: Environment Variables sidebar_label: Environment Variables --- TeslaMate accepts the following environment variables for runtime configuration: | Variable Name | Description | Default Value | | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | **ENCRYPTION_KEY** | A key used to encrypt the Tesla API tokens (**required**) | | | **DATABASE_USER** | Username (**required**) | | | **DATABASE_PASS** | User password (**required**) | | | **DATABASE_NAME** | The database to connect to (**required**) | | | **DATABASE_HOST** | Hostname of the database server (**required**) | | | **DATABASE_PORT** | Port of the database server | 5432 | | **DATABASE_POOL_SIZE** | Size of the database connection pool | 10 | | **DATABASE_TIMEOUT** | The time in milliseconds to wait for database query calls to finish | 60000 | | **DATABASE_SSL** | Set to `true` if SSL should be enabled or `noverify` if certificate verification should not be performed. | false | | **DATABASE_SSL_CA_CERT_FILE** | Path to a file containing PEM-encoded CA certificates (required if `DATABASE_SSL` is set to `true`) | | | **DATABASE_SSL_SNI** | set SNI for host undel ssl mode | | | **DATABASE_IPV6** | Set to `true` if IPv6 should be used | false | | **VIRTUAL_HOST** | Host part used for generating URLs throughout the app | localhost | | **URL_PATH** | Path used for generating URLs (can be used with a reverse proxy) | / | | **CHECK_ORIGIN** | Configures whether to check the origin header or not. May be `true` (**recommended**), `false` (_default_) or a comma-separated list of hosts that are allowed (e.g. `https://example.com,//another.com:8080`). Hosts also support wildcards. If `true`, it will check against the host value in `VIRTUAL_HOST`. | false | | **PORT** | Port where the web interface is exposed | 4000 | | **HTTP_BINDING_ADDRESS** | IP address where the web interface is exposed, or blank (_default_) meaning all addresses. | | | **DISABLE_MQTT** | Disables the MQTT feature if `true` | false | | **MQTT_HOST** | Hostname of the broker (**required** unless DISABLE_MQTT is `true`) | | | **MQTT_PORT** | Port of the broker | 1883 (8883 for MQTT over TLS) | | **MQTT_USERNAME** | Username | | | **MQTT_PASSWORD** | Password | | | **MQTT_TLS** | Enables TLS if `true` | false | | **MQTT_TLS_ACCEPT_INVALID_CERTS** | Accepts invalid certificates if `true` | false | | **MQTT_IPV6** | Set to `true` if IPv6 should be used | false | | **MQTT_NAMESPACE** | Inserts a custom namespace into the MQTT topic . For example, with `MQTT_NAMESPACE=account_0`: `teslamate/account_0/cars/$car_id/state`. | | | **IMPORT_DIR** | The path of the directory for the import of data (e.g. TeslaFi) | ./import | | **TZ** | Used to establish the local time zone, e.g. to use the local time in logs. See [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). | | | **DEFAULT_GEOFENCE** | The default GEOFENCE to send via GEOFENCE if car not in geofence. Overrides the default of "" which will delete any retained value. | "" (no quotes) | | **TESLAFI_IMPORT_VEHICLE_ID** | The default Vehicle ID used when importing from TeslaFi. If it is not defined and the import source does not contain the data, 1 is used. | | | **TESLA_API_HOST** | Hostname of the Tesla API | https://owner-api.teslamotors.com (or for chinese: https://owner-api.vn.cloud.tesla.cn) | | **TESLA_AUTH_HOST** | Hostname of the Tesla authentication API | https://auth.tesla.com | | **TESLA_AUTH_PATH** | The Tesla authentication path | /oauth2/v3 | | **TESLA_AUTH_CLIENT_ID** | Client ID of the application registered on [developer.tesla.com](https://developer.tesla.com) | ownerapi | | **TESLA_WSS_HOST** | Hostname of the Tesla streaming | wss://streaming.vn.teslamotors.com (or for chinese: wss://streaming.vn.cloud.tesla.cn) | | **TESLA_WSS_TLS_ACCEPT_INVALID_CERTS** | Accepts invalid certificates on TESLA_WSS_HOST if `true` | | | **TESLA_WSS_USE_VIN** | Use the `vin` field instead of `vid` to connect stream if `true` | | | **TOKEN** | Token given by a third party Tesla API provider. This `TOKEN` is added to each API request and the format must be `?token=xxxx-xxxx-xxxx` | | | **POLLING_ASLEEP_INTERVAL** | Interval between API fetch when the vehicle is asleep (in seconds). **Important: Do not alter this setting unless you are certain of the implications.** | 30 | | **POLLING_CHARGING_INTERVAL** | Minimum interval between API fetch when the vehicle is charging (in seconds). **Important: Do not alter this setting unless you are certain of the implications.** | 5 | | **POLLING_DRIVING_INTERVAL** | Interval between API fetch when the vehicle is driving (in seconds). **Important: Do not alter this setting unless you are certain of the implications.** | 2.5 | | **POLLING_ONLINE_INTERVAL** | Interval between API fetch when the vehicle is online (in seconds). **Important: Do not alter this setting unless you are certain of the implications.** | 60 | | **POLLING_DEFAULT_INTERVAL** | Default interval between API fetch (in seconds). **Important: Do not alter this setting unless you are certain of the implications.** | 15 | | **POLLING_MINIMUM_INTERVAL** | Minimum interval between API fetch. No minimum by default. **Important: Do not alter this setting unless you are certain of the implications.** | 0 |