chore(db): get InfluxDB token by secrets

Assisted-by: Gemini:gemini-3-flash
Signed-off-by: Klagarge <remi@heredero.ch>
This commit is contained in:
2026-05-01 22:02:55 +02:00
parent cea4435bbc
commit 25438f085e

View File

@@ -66,8 +66,19 @@ func influxConnection() *influx.InfluxGateway {
influxDatabase = "provence"
}
influxToken, ok := os.LookupEnv("INFLUX_TOKEN")
if !ok {
influxToken := os.Getenv("INFLUX_TOKEN")
if influxToken == "" {
if tokenFile := os.Getenv("INFLUX_TOKEN_FILE"); tokenFile != "" {
content, err := os.ReadFile(tokenFile)
if err == nil {
influxToken = strings.TrimSpace(string(content))
} else {
log.Printf("[Main] Warning: could not read token file %s: %v\n", tokenFile, err)
}
}
}
if influxToken == "" {
influxToken = "password"
}