mirror of
https://github.com/tobiasehlert/teslamateapi.git
synced 2026-02-27 09:54:18 +08:00
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:
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user