Don't error if a config isn't available
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Elara 2023-12-05 02:07:31 +00:00
parent 9790206f16
commit 7bc24e986a

View File

@ -41,14 +41,14 @@ func loadConfig() (*Config, error) {
cfg := &Config{} cfg := &Config{}
fl, err := os.Open("/etc/owobot.toml") fl, err := os.Open("/etc/owobot.toml")
if err != nil { if err == nil {
return nil, err err = toml.NewDecoder(fl).Decode(cfg)
} if err != nil {
defer fl.Close() return nil, err
err = toml.NewDecoder(fl).Decode(cfg) }
if err != nil { fl.Close()
return nil, err
} }
return cfg, env.ParseWithOptions(cfg, env.Options{Prefix: "OWOBOT_"}) return cfg, env.ParseWithOptions(cfg, env.Options{Prefix: "OWOBOT_"})
} }