diff --git a/internal/configuration/configuration.go b/internal/configuration/configuration.go index ac29a01..be7bc59 100644 --- a/internal/configuration/configuration.go +++ b/internal/configuration/configuration.go @@ -29,16 +29,20 @@ func LoadConfiguration(path string) (*Configuration, error) { if err != nil { return nil, errors.Wrap(err, "failed to open configuration file") } + defer configFile.Close() config := &Configuration{} if err := yaml.NewDecoder(configFile).Decode(config); err != nil { - return nil, errors.Wrap(err, "failed to decode configuration file") + return nil, errors.Wrap(err, "failed to parse configuration file") } return config, nil } +// SplitNetworkAddress splits ListenOn option and returns as two strings +// network type (e.g. tcp, unix, udp) and address:port or /path/to/prog.socket +// to listen on. func (c *Configuration) SplitNetworkAddress() (n string, a string) { s := strings.Split(c.ListenOn, " ") n, a = s[0], s[1]