From b05ae1c2d253e92c09a67cef3570fda9e5eb7384 Mon Sep 17 00:00:00 2001 From: TwinProduction Date: Thu, 25 Jun 2020 21:31:34 -0400 Subject: [PATCH] Minor improvement --- config/config.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/config/config.go b/config/config.go index 5af058bd..08152b68 100644 --- a/config/config.go +++ b/config/config.go @@ -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")