mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-21 23:43:27 +01:00
Minor improvement
This commit is contained in:
parent
3b309500c3
commit
b05ae1c2d2
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user