Don't error if a config isn't available
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
9790206f16
commit
7bc24e986a
14
config.go
14
config.go
@ -41,14 +41,14 @@ func loadConfig() (*Config, error) {
|
||||
cfg := &Config{}
|
||||
|
||||
fl, err := os.Open("/etc/owobot.toml")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer fl.Close()
|
||||
err = toml.NewDecoder(fl).Decode(cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if err == nil {
|
||||
err = toml.NewDecoder(fl).Decode(cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fl.Close()
|
||||
}
|
||||
|
||||
|
||||
return cfg, env.ParseWithOptions(cfg, env.Options{Prefix: "OWOBOT_"})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user