mirror of
https://github.com/Luzifer/streamdeck.git
synced 2024-12-29 22:21:24 +00:00
[#4] Use strict config parsing
in order to detect and not silently eat configuration errors during start-up fixes #4 Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
7cf0022f5b
commit
957d0f36a6
1 changed files with 7 additions and 2 deletions
|
@ -63,8 +63,13 @@ func loadConfig() error {
|
||||||
}
|
}
|
||||||
defer userConfFile.Close()
|
defer userConfFile.Close()
|
||||||
|
|
||||||
tempConf := newConfig()
|
var (
|
||||||
if err = yaml.NewDecoder(userConfFile).Decode(&tempConf); err != nil {
|
decoder = yaml.NewDecoder(userConfFile)
|
||||||
|
tempConf = newConfig()
|
||||||
|
)
|
||||||
|
|
||||||
|
decoder.SetStrict(true)
|
||||||
|
if err = decoder.Decode(&tempConf); err != nil {
|
||||||
return errors.Wrap(err, "Unable to parse config")
|
return errors.Wrap(err, "Unable to parse config")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue