e766f580bb
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
33 lines
426 B
Go
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
|
|
}
|