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