This commit is contained in:
2023-11-27 11:56:00 +01:00
parent 72b1b246be
commit faef995b6f
5 changed files with 46 additions and 5 deletions

35
src/udi/config/config.go Normal file
View File

@ -0,0 +1,35 @@
package config
import "encoding/json"
import "log"
import "os"
type ConfigT struct {
Mqtt struct {
Broker string
Username string
Password string
TlsEnable string
}
TopicMappings []struct {
Topics []string
Plugin string
}
Plugins []struct {
Name string
DatabaseConnStr string
Attributes map[string]interface{}
}
}
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)
}
}