1
0

Func LoadConfiguration() was renamed to Load(). Added a comment for it. Edited a comment for SplitNetworkAddress() func.

This commit is contained in:
Alexander Andreev 2023-02-07 02:29:45 +04:00
parent bde8a59a31
commit dc8ec51530
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -24,7 +24,8 @@ type Configuration struct {
} `yaml:"log"`
}
func LoadConfiguration(path string) (*Configuration, error) {
// Load reads a YAML file that stores configuration of a service.
func Load(path string) (*Configuration, error) {
configFile, err := os.Open(path)
if err != nil {
return nil, errors.Wrap(err, "failed to open configuration file")
@ -40,9 +41,8 @@ func LoadConfiguration(path string) (*Configuration, error) {
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.
// SplitNetworkAddress splits ListenOn option into network type (e.g. tcp, unix,
// udp) and address:port or /path/to/service.socket to listen on.
func (c *Configuration) SplitNetworkAddress() (string, string) {
s := strings.Split(c.ListenOn, " ")
return s[0], s[1]