Files
archived-teslamate/website/docs/configuration/environment_variables.md
T
Jakob Lichterfeld 0973b497ed feat: Add ulimit cap to prevent memory bloat in some misconfigured versions of Docker/containerd Hosts (e.g. on Debian 13)
On certain systems (e.g., Debian 13 with modern container runtimes), a very high default `nofiles` ulimit can cause the Erlang VM (beam.smp) to pre-allocate excessive amounts of memory, leading to container crashes.

This change introduces a safeguard directly into the entrypoint script:
- It caps the soft `ulimit -n` to a configurable maximum, defined by the `ULIMIT_MAX_NOFILE` environment variable (defaults to 65536).
- This behavior can be disabled by setting `ULIMIT_MAX_NOFILE=0`.
- The new environment variable has been added to the documentation.

To satisfy ShellCheck (SC3045), the script's shebang is set to `#!/usr/bin/env dash`, as `ulimit -n` is a common but not strictly POSIX-compliant extension.
2025-11-05 16:45:52 +01:00

26 KiB

id, title, sidebar_label
id title sidebar_label
environment_variables Environment Variables 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
DATABASE_PASS User password
DATABASE_NAME The database to connect to
DATABASE_HOST Hostname of the database server
DATABASE_PORT Port of the database server 5432
DATABASE_SOCKET_DIR Local path containing UNIX socket for database if that connection mechanic is preferred. Provide one of DATABASESOCKET_DIR and DATABASE(USER|PASS|HOST|PORT)
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.
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_API_POOL_SIZE HTTP pool size limit for TESLA_API_HOST domain API 10
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 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
HTTP_POOL_SIZE The default size of the HTTP connection pool for domains other than TESLA_API_HOST, nominatim.openstreetmap.org, and api.github.com. This setting determines the maximum number of simultaneous connections allowed for these domains. 5
HTTP_POOL_TIMEOUT The maximum time (in microseconds) to wait for a connection from the HTTP pool before timing out. This setting helps prevent indefinite waits when the pool is exhausted. 10000
ULIMIT_MAX_NOFILE Sets the maximum number of open file descriptors for the TeslaMate process. This can prevent memory bloat in environments with very high default ulimit values. Set to 0 to disable this feature. 65536
NOMINATIM_PROXY HTTP proxy for OpenStreetMap Nominatim API requests (e.g. http://127.0.0.1:7897, HTTP only). Similar to nominatim_http_proxy.