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:
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user