Support config.yml (as an alternative to config.yaml)

This commit is contained in:
TwinProduction 2019-11-16 15:01:40 -05:00
parent 5f93894341
commit 9cf118996d

View File

@ -5,6 +5,7 @@ import (
"github.com/TwinProduction/gatus/core" "github.com/TwinProduction/gatus/core"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
"io/ioutil" "io/ioutil"
"os"
"time" "time"
) )
@ -20,9 +21,16 @@ var (
func Get() *Config { func Get() *Config {
if config == nil { if config == nil {
cfg, err := readConfigurationFile("config.yaml") cfg, err := readConfigurationFile("config.yaml")
if err != nil {
if os.IsNotExist(err) {
cfg, err = readConfigurationFile("config.yml")
if err != nil { if err != nil {
panic(err) panic(err)
} }
} else {
panic(err)
}
}
config = cfg config = cfg
} }
return config return config