Files
universal-data-ingest/src/udi/config/config.go
Wolfgang Hottgenroth 96377e9572
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
start deployment stuff
2023-12-17 22:36:13 +01:00

41 lines
832 B
Go

package config
import "encoding/json"
import "log"
import "os"
type HandlerConfigT struct {
Attributes map[string]string `json:"attributes"`
}
type ConfigT struct {
Mqtt struct {
Broker string `json:"broker"`
Username string `json:"username"`
Password string
TlsEnable string `json:"tlsEnable"`
} `json:"mqtt"`
TopicMappings []struct {
Id string `json:"id"`
Topics []string `json:"topics"`
Handler string `json:"handler"`
Config HandlerConfigT `json:"config"`
} `json:"topicMappings"`
Archiver struct {
Dir string `json:"dir"`
}
}
var Config ConfigT
func LoadConfiguration() {
err := json.Unmarshal([]byte(os.Getenv("UDI_CONF")), &Config)
if err != nil {
log.Fatalf("Unable to parse configuration: %s", err)
}
Config.Mqtt.Password = os.Getenv("MQTT_PASSWORD")
}