1
0
Fork 0
mirror of https://github.com/TwiN/gatus.git synced 2024-12-14 11:58:04 +00:00

Minor improvement

This commit is contained in:
TwinProduction 2020-06-25 21:31:34 -04:00
parent 3b309500c3
commit b05ae1c2d2

View file

@ -9,10 +9,9 @@ import (
"os"
)
type Config struct {
Metrics bool `yaml:"metrics"`
Services []*core.Service `yaml:"services"`
}
const (
DefaultConfigurationFilePath = "config/config.yaml"
)
var (
ErrNoServiceInConfig = errors.New("configuration file should contain at least 1 service")
@ -21,6 +20,11 @@ var (
config *Config
)
type Config struct {
Metrics bool `yaml:"metrics"`
Services []*core.Service `yaml:"services"`
}
func Get() *Config {
if config == nil {
panic(ErrConfigNotLoaded)
@ -43,7 +47,7 @@ func Load(configFile string) error {
}
func LoadDefaultConfiguration() error {
err := Load("config/config.yaml")
err := Load(DefaultConfigurationFilePath)
if err != nil {
if err == ErrConfigFileNotFound {
return Load("config/config.yml")