From 2c4639e32d8bd9fbacfceffe5d2b5058d9f56a82 Mon Sep 17 00:00:00 2001 From: jlestel Date: Wed, 26 Jun 2024 10:58:31 +0200 Subject: [PATCH] feat: allow Fleet API users to change client_id (#3984) Co-authored-by: Julien --- lib/tesla_api/auth.ex | 2 +- website/docs/configuration/environment_variables.md | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/tesla_api/auth.ex b/lib/tesla_api/auth.ex index e045710b6d..a343840af1 100644 --- a/lib/tesla_api/auth.ex +++ b/lib/tesla_api/auth.ex @@ -6,7 +6,7 @@ defmodule TeslaApi.Auth do @web_client_id "ownerapi" @redirect_uri "https://auth.tesla.com/void/callback" - def web_client_id, do: @web_client_id + def web_client_id, do: System.get_env("TESLA_AUTH_CLIENT_ID") || @web_client_id def redirect_uri, do: @redirect_uri @default_headers [ diff --git a/website/docs/configuration/environment_variables.md b/website/docs/configuration/environment_variables.md index 7f2f6e84c1..ba7822a3ac 100644 --- a/website/docs/configuration/environment_variables.md +++ b/website/docs/configuration/environment_variables.md @@ -7,7 +7,7 @@ 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**) | | @@ -37,10 +37,11 @@ TeslaMate accepts the following environment variables for runtime configuration: | **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. +| **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` | |