feat: add ability to use custom API endpoint (#307)

Co-authored-by: Julien <julien@citio.digital>
Co-authored-by: Tobias Lindberg <tobias.ehlert@gmail.com>
This commit is contained in:
jlestel
2024-11-21 22:13:48 +01:00
committed by GitHub
parent d0acd6ba40
commit 655d44ac59
3 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -112,9 +112,9 @@ func TeslaMateAPICarsCommandV1(c *gin.Context) {
switch getCarRegionAPI(TeslaAccessToken) {
case ChinaAPI:
TeslaEndpointUrl = "https://owner-api.vn.cloud.tesla.cn"
TeslaEndpointUrl = getEnv("TESLA_API_HOST", "https://owner-api.vn.cloud.tesla.cn")
default:
TeslaEndpointUrl = "https://owner-api.teslamotors.com"
TeslaEndpointUrl = getEnv("TESLA_API_HOST", "https://owner-api.teslamotors.com")
}
client := &http.Client{}
+5 -1
View File
@@ -74,7 +74,11 @@ func main() {
}
if getEnvAsBool("API_TOKEN_DISABLE", false) {
log.Println("[warning] validateAuthToken - header authorization bearer token disabled. Authorizaiton: Bearer token will not be required for commands.")
log.Println("[warning] validateAuthToken - header authorization bearer token disabled. Authorization: Bearer token will not be required for commands.")
}
if teslaApiHost := getEnv("TESLA_API_HOST", ""); teslaApiHost != "" {
log.Println("[info] TESLA_API_HOST is set: %s", teslaApiHost)
}
// kicking off Gin in value r