logman/config.go

33 lines
426 B
Go
Raw Permalink Normal View History

2019-08-13 09:48:47 -05:00
package main
2019-08-13 10:01:26 -05:00
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
2019-08-13 09:48:47 -05:00
type Configuration struct {
Username string
Password string
Port int
2019-08-13 09:48:47 -05:00
Hosts []string
Logs []string
2019-08-13 09:48:47 -05:00
}
2019-08-13 10:01:26 -05:00
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)
}
2019-08-13 09:48:47 -05:00
2019-08-13 10:01:26 -05:00
return config
2019-08-13 09:48:47 -05:00
}