diff options
| author | xengineering <me@xengineering.eu> | 2025-12-20 14:11:13 +0100 |
|---|---|---|
| committer | xengineering <me@xengineering.eu> | 2025-12-20 14:11:13 +0100 |
| commit | 224d52d1033d8ccce5087c9bee5a63457830a13a (patch) | |
| tree | cfd0b61e66258a0121ef20d4572561aee84b8db3 /config.go | |
| parent | d6fa255b1df26a12329a614601a027e074aabeb2 (diff) | |
| download | sia-server-224d52d1033d8ccce5087c9bee5a63457830a13a.tar sia-server-224d52d1033d8ccce5087c9bee5a63457830a13a.tar.zst sia-server-224d52d1033d8ccce5087c9bee5a63457830a13a.zip | |
Use default config
The default config JSON is embedded as bytes into the executable.
Instead of constants the default values are now parsed from these
embedded bytes.
Diffstat (limited to 'config.go')
| -rw-r--r-- | config.go | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -9,17 +9,20 @@ import ( //go:embed configs/default.json var defaultConfig []byte -type StartupConfig struct { - MQTT struct { - Broker string `json:"broker"` - ClientID string `json:"client-id"` - TopicPrefix string `json:"topic-prefix"` - } `json:"mqtt"` +type MQTTConfig struct { + Broker string `json:"broker"` + ClientID string `json:"client-id"` + TopicPrefix string `json:"topic-prefix"` +} - Homematic struct { - CCU string `json:"ccu"` - PollingPeriodMilliseconds int `json:"polling-period-milliseconds"` - } `json:"homematic"` +type HomematicConfig struct { + CCU string `json:"ccu"` + PollingPeriod string `json:"polling-period"` +} + +type StartupConfig struct { + MQTT MQTTConfig `json:"mqtt"` + Homematic HomematicConfig `json:"homematic"` } func (sc *StartupConfig) FromJSON(data []byte) error { |
