diff options
| author | xengineering <me@xengineering.eu> | 2025-12-20 14:25:45 +0100 |
|---|---|---|
| committer | xengineering <me@xengineering.eu> | 2025-12-20 14:25:45 +0100 |
| commit | 0dc4bea01a2f51b8a1c8f8b8c586e040c065fe38 (patch) | |
| tree | 71516dc7850ac573fcb7b207418b68fbb2e8abdf /config.go | |
| parent | 167772b87698cce479090dbe5bd3d1cc7c1bc808 (diff) | |
| download | sia-server-0dc4bea01a2f51b8a1c8f8b8c586e040c065fe38.tar sia-server-0dc4bea01a2f51b8a1c8f8b8c586e040c065fe38.tar.zst sia-server-0dc4bea01a2f51b8a1c8f8b8c586e040c065fe38.zip | |
Add startup config logging
This is useful during early development to make possible
misconfiguration visible.
Later it might be dropped especially if the config gets larger.
Diffstat (limited to 'config.go')
| -rw-r--r-- | config.go | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -50,6 +50,19 @@ type StartupConfig struct { Homematic HomematicConfig `json:"homematic"` } +func (sc StartupConfig) String() string { + prefix := "" + indent := "\t" + + data, err := json.MarshalIndent(sc, prefix, indent) + if err != nil { + log.Println("Failed to marshal startup configuration.") + return "" + } + + return string(data) +} + func (sc StartupConfig) Validate() error { if !mqttBrokerRegexp.MatchString(sc.MQTT.Broker) { return fmt.Errorf( @@ -152,5 +165,7 @@ func GetStartupConfig(path string) StartupConfig { } } + log.Printf("Startup configuration:\n%v", config) + return config } |
