logman/config.go
2019-08-13 11:01:26 -04:00

32 lines
410 B
Go

package main
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
type Configuration struct {
Username string
Password string
Port string
Hosts []string
}
func initializeConfig(filename string) Configuration {
var config Configuration
source, err := ioutil.ReadFile(filename)
if err != nil {
panic(err)
}
err = yaml.Unmarshal(source, &config)
if err != nil {
panic(err)
}
return config
}