mirror of
https://github.com/tobiasehlert/teslamateapi.git
synced 2026-02-27 09:54:18 +08:00
Merge pull request #48 from gaussmeter/feature-10-logging
SSL: true|false, FQDN -> HOST
This commit is contained in:
@@ -100,8 +100,8 @@ Basically the same environment variables for the database, mqqt and timezone nee
|
||||
|
||||
**Optional** environment variables
|
||||
|
||||
- **TESLAMATE_PROTOCOL** string *(default: http)*
|
||||
- **TESLAMATE_FQDN** string *(default: teslamate)*
|
||||
- **TESLAMATE_SSL** boolean *(default: false)*
|
||||
- **TESLAMATE_HOST** string *(default: teslamate)*
|
||||
- **TESLAMATE_PORT** string *(default: 4000)*
|
||||
- **API_TOKEN** string *(default: )*
|
||||
- **DATABASE_PORT** integer *(default: 5432)*
|
||||
|
||||
@@ -71,7 +71,13 @@ func TeslaMateAPICarsLoggingV1(c *gin.Context) {
|
||||
}
|
||||
|
||||
client := &http.Client{}
|
||||
putURL := getEnv("TESLAMATE_PROTOCOL", "http") + "://" + getEnv("TESLAMATE_FQDN", "teslamate") + ":" + getEnv("TESLAMATE_PORT", "4000") + "/api/car/" + ParamCarID + command
|
||||
putURL := ""
|
||||
if getEnvAsBool("TESLAMATE_SSL", false) {
|
||||
putURL = "https://"
|
||||
} else {
|
||||
putURL = "http://"
|
||||
}
|
||||
putURL = putURL + getEnv("TESLAMATE_HOST", "teslamate") + ":" + getEnv("TESLAMATE_PORT", "4000") + "/api/car/" + ParamCarID + command
|
||||
req, _ := http.NewRequest(http.MethodPut, putURL, strings.NewReader(string(reqBody)))
|
||||
req.Header.Set("User-Agent", "TeslaMateApi/"+apiVersion+" https://github.com/tobiasehlert/teslamateapi")
|
||||
resp, err := client.Do(req)
|
||||
|
||||
Reference in New Issue
Block a user