database configuration only via PG* env variables and MQTT password only via configured env var
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2023-12-17 13:53:16 +01:00
parent 6d932f56c8
commit ee2c5f31e8
11 changed files with 59 additions and 38 deletions

View File

@ -5,7 +5,6 @@ import "log"
import "os"
type HandlerConfigT struct {
DatabaseConnStr string `json:"databaseConnStr"`
Attributes map[string]string `json:"attributes"`
}
@ -13,7 +12,8 @@ type ConfigT struct {
Mqtt struct {
Broker string `json:"broker"`
Username string `json:"username"`
Password string `json:"password"`
PasswordEnvVar string `json:"passwordEnvVar"`
Password string
TlsEnable string `json:"tlsEnable"`
} `json:"mqtt"`
TopicMappings []struct {
@ -36,8 +36,8 @@ func LoadConfiguration() {
log.Fatalf("Unable to parse configuration: %s", err)
}
if Config.Mqtt.Password == "ENV" {
Config.Mqtt.Password = os.Getenv("MQTT_PASSWORD")
if Config.Mqtt.PasswordEnvVar != "" {
Config.Mqtt.Password = os.Getenv(Config.Mqtt.PasswordEnvVar)
}
}