mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-25 09:24:04 +01:00
Minor improvement
This commit is contained in:
parent
3b309500c3
commit
b05ae1c2d2
@ -9,10 +9,9 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
const (
|
||||||
Metrics bool `yaml:"metrics"`
|
DefaultConfigurationFilePath = "config/config.yaml"
|
||||||
Services []*core.Service `yaml:"services"`
|
)
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrNoServiceInConfig = errors.New("configuration file should contain at least 1 service")
|
ErrNoServiceInConfig = errors.New("configuration file should contain at least 1 service")
|
||||||
@ -21,6 +20,11 @@ var (
|
|||||||
config *Config
|
config *Config
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
Metrics bool `yaml:"metrics"`
|
||||||
|
Services []*core.Service `yaml:"services"`
|
||||||
|
}
|
||||||
|
|
||||||
func Get() *Config {
|
func Get() *Config {
|
||||||
if config == nil {
|
if config == nil {
|
||||||
panic(ErrConfigNotLoaded)
|
panic(ErrConfigNotLoaded)
|
||||||
@ -43,7 +47,7 @@ func Load(configFile string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func LoadDefaultConfiguration() error {
|
func LoadDefaultConfiguration() error {
|
||||||
err := Load("config/config.yaml")
|
err := Load(DefaultConfigurationFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == ErrConfigFileNotFound {
|
if err == ErrConfigFileNotFound {
|
||||||
return Load("config/config.yml")
|
return Load("config/config.yml")
|
||||||
|
Loading…
Reference in New Issue
Block a user