mirror of
https://github.com/TwiN/gatus.git
synced 2024-12-14 11:58:04 +00:00
Minor improvement
This commit is contained in:
parent
3b309500c3
commit
b05ae1c2d2
1 changed files with 9 additions and 5 deletions
|
@ -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 a new issue