Return yaml unmarshal error

This commit is contained in:
TwinProduction 2020-10-16 12:12:00 -04:00
parent 58b9b17944
commit 816bc95905

View File

@ -81,6 +81,9 @@ func parseAndValidateConfigBytes(yamlBytes []byte) (config *Config, err error) {
yamlBytes = []byte(os.ExpandEnv(string(yamlBytes))) yamlBytes = []byte(os.ExpandEnv(string(yamlBytes)))
// Parse configuration file // Parse configuration file
err = yaml.Unmarshal(yamlBytes, &config) err = yaml.Unmarshal(yamlBytes, &config)
if err != nil {
return
}
// Check if the configuration file at least has services. // Check if the configuration file at least has services.
if config == nil || config.Services == nil || len(config.Services) == 0 { if config == nil || config.Services == nil || len(config.Services) == 0 {
err = ErrNoServiceInConfig err = ErrNoServiceInConfig