fix: allow empty config file bootstrap before provisioning

Treat an empty CONFIG_FILE as initial state instead of failing JSON parse, so provisioning can proceed and credentials can be saved. Ref: fosrl/pangolin#2812
This commit is contained in:
Laurence
2026-04-08 14:13:13 +01:00
parent 27e471942e
commit d7c3c38d24
2 changed files with 40 additions and 0 deletions

View File

@@ -71,6 +71,11 @@ func (c *Client) loadConfig() error {
}
return err
}
if len(bytes.TrimSpace(data)) == 0 {
logger.Info("Config file at %s is empty, will initialize it with provided values", configPath)
c.configNeedsSave = true
return nil
}
var config Config
if err := json.Unmarshal(data, &config); err != nil {