-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.env.example
More file actions
151 lines (133 loc) Β· 6.04 KB
/
Copy path.env.example
File metadata and controls
151 lines (133 loc) Β· 6.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# TeslaSync Environment Configuration
# Copy this file to .env and update the values
# Tesla API credentials (required)
# Register at https://developer.tesla.com
TESLA_CLIENT_ID=
TESLA_CLIENT_SECRET=
TESLA_REDIRECT_URI=http://localhost:8080/api/v1/auth/callback
# Fleet API region (NA/EU/CN)
# NA: https://fleet-api.prd.na.vn.cloud.tesla.com
# EU: https://fleet-api.prd.eu.vn.cloud.tesla.com
# CN: https://fleet-api.prd.cn.vn.cloud.tesla.com
TESLA_API_BASE_URL=https://fleet-api.prd.na.vn.cloud.tesla.com
# Conservative UTC-daily estimated spend guard. Set 0 only to opt out.
TESLA_API_DAILY_BUDGET_USD=0.30
# Capacity protected from background reads for wake-ups and commands.
TESLA_API_COMMAND_RESERVE_USD=0.05
# Database
POSTGRES_USER=teslasync
POSTGRES_PASSWORD=changeme
POSTGRES_DB=teslasync
POSTGRES_PORT=5432
POSTGRES_MAX_CONNECTIONS=50
# Home-lab-safe connection budget. Each worker has its own smaller pool so the
# steady-state stack can use at most 22 connections (24 while migrations run),
# leaving headroom below POSTGRES_MAX_CONNECTIONS for TimescaleDB maintenance.
# Raise the server ceiling before raising any individual pool.
DATABASE_MAX_CONNS=12
DATABASE_MIN_CONNS=2
NOTIFICATION_WORKER_DB_MAX_CONNS=2
NOTIFICATION_WORKER_DB_MIN_CONNS=1
EXPORT_WORKER_DB_MAX_CONNS=2
EXPORT_WORKER_DB_MIN_CONNS=1
AUTOMATION_WORKER_DB_MAX_CONNS=2
AUTOMATION_WORKER_DB_MIN_CONNS=1
# Application
TESLASYNC_PORT=8080
WEB_PORT=3000
WORKER_POLL_INTERVAL=30s
LOG_LEVEL=info
# Storage retention
# Retention runs only after you verify a recoverable backup and set the
# acknowledgement to true. Upgrades remain non-destructive by default.
SIGNAL_HISTORY_RETENTION_DAYS=365
SIGNAL_HISTORY_RETENTION_ACKNOWLEDGED=false
POSITION_RETENTION_DAYS=0
DATA_RETENTION_DAYS=0
# CORS (set to your domain in production)
# CORS_ORIGINS=https://teslasync.example.com
# Encryption key for tokens at rest (recommended for production)
# Generate with: openssl rand -base64 32
# ENCRYPTION_KEY=
# Grafana
GRAFANA_PORT=3001
GRAFANA_USER=admin
GRAFANA_PASSWORD=changeme
# Distributed tracing (optional β pair with: docker compose --profile tracing up)
# Required for the Tempo, service-graph, span-metrics, and SLO trace dashboards.
OTEL_ENABLED=false
OTEL_ENDPOINT=otel-collector:4317
OTEL_INSECURE=true
# Synthetic checks (optional)
# Enable and configure named probe URLs, the multi-step operator journey, or both.
SYNTHETIC_ENABLED=false
SYNTHETIC_INTERVAL_SECONDS=60
SYNTHETIC_TIMEOUT_SECONDS=30
SYNTHETIC_PROBE_URLS=
SYNTHETIC_JOURNEY_BASE_URL=
# MQTT
MQTT_PORT=1883
# Redis
REDIS_PORT=6379
# Sleep backoff: when a vehicle returns 408 (asleep), polling backs off
# exponentially using WORKER_SLEEP_POLL_MULT (default 4x): 60s β 120s β 240s β 10 min cap.
# API suspend: use the Settings UI or POST /api/v1/settings/suspend-api to suspend
# all Tesla Fleet API calls (e.g., when vehicle is in service). Token refresh continues.
# Fleet Telemetry (optional β enable with: docker compose --profile telemetry up)
# When enabled, Fleet Telemetry is the PRIMARY data source. The worker only polls
# non-streaming vehicles as a fallback via the Tesla Fleet API.
# For production: set FLEET_TELEMETRY_ENABLED=true for full drive telemetry
# (distance, speed, SOC, elevation, etc.). Without it, the API polling fallback
# records the same data but at lower resolution (~15s intervals vs real-time).
FLEET_TELEMETRY_PORT=4443
FLEET_TELEMETRY_ENABLED=false
FLEET_TELEMETRY_HOST=
FLEET_TELEMETRY_TOPIC_BASE=telemetry
# Coalesce per-field MQTT messages while bounding database concurrency below
# DATABASE_MAX_CONNS so API requests retain connection headroom.
FLEET_TELEMETRY_BATCH_MS=100
FLEET_TELEMETRY_BATCH_MAX_MESSAGES=256
# Two workers are sufficient for a typical 1-2 vehicle home deployment and
# reserve ten API-pool connections for interactive traffic. Larger fleets can
# raise this conservatively, keeping it below DATABASE_MAX_CONNS.
FLEET_TELEMETRY_PERSISTENCE_CONCURRENCY=2
FLEET_TELEMETRY_PERSISTENCE_QUEUE_CAPACITY=64
FLEET_TELEMETRY_PERSISTENCE_TIMEOUT=30s
FLEET_TELEMETRY_SNAPSHOT_WRITE_INTERVAL=10s
FLEET_TELEMETRY_STALE_TIMEOUT=15m
FLEET_TELEMETRY_FALLBACK_POLL_INTERVAL=5m
FLEET_TELEMETRY_CLEANUP_INTERVAL=2m
FLEET_TELEMETRY_STALE_SESSION_TIMEOUT=5m
# FLEET_TELEMETRY_TLS_CERT=./certs/server.crt
# FLEET_TELEMETRY_TLS_KEY=./certs/server.key
# Authentik SSE Auth (optional β production only)
# When set, the SSE /events endpoint validates JWTs directly instead of
# relying solely on Traefik ForwardAuth. Required for SSE bypass IngressRoute.
# If only ForwardAuth is used (no SSE bypass), SSE falls back to ForwardAuth headers.
# AUTHENTIK_URL=http://authentik-server.authentik.svc.cluster.local/application/o/<client-id>/jwks/
# AUTHENTIK_HMAC_KEY=
# Geocoding (optional β enables address lookup for drive positions)
# GOOGLE_MAPS_API_KEY=
# AZURE_MAPS_API_KEY=
# Gas Price Polling (optional β enables US average gas price for cost comparison)
# Register at https://www.eia.gov/opendata/
# EIA_API_KEY=
# ββ Build identity βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# VERSION stamps the Go images only (api, notification-worker, export-worker,
# automation-worker). It deliberately does NOT reach the web image: a version
# without an immutable commit id cannot rotate the service worker's cache
# buckets, and wiring VERSION into the SPA used to fail `docker compose build`
# for anyone who set it purely for their API image.
# VERSION=
# The web image has its own opt-in pair. Leave BOTH unset for the normal,
# deliberately unversioned local build (`dev-<package version>`, which the PWA
# update handshake treats as "no signal" and can never turn into a stuck
# "update required" prompt).
#
# Setting only WEB_APP_VERSION degrades back to the unversioned identity with a
# warning β it never produces a fake release identity, and it never breaks the
# build. Set both to stamp a real, cache-rotating identity:
# WEB_APP_VERSION=1.2.3
# WEB_GIT_SHA=$(git rev-parse --short HEAD)
# WEB_APP_VERSION=
# WEB_GIT_SHA=