logman/config.go
Wyatt J. Miller e766f580bb added generate.go, added todo
Added generate.go out of habit for idiots like me who delete config
files like it's no big deal. Also added a markdown file called todo,
name is self-explanatory as it helps me remember stuff that I need
to do and as well helps contributors figure what needs to happen
2019-09-25 23:17:38 -04:00

33 lines
426 B
Go

package main
import (
"io/ioutil"
"gopkg.in/yaml.v2"
)
type Configuration struct {
Username string
Password string
Port int
Hosts []string
Logs []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
}