1
0
httpprocprobed/configuration.go

28 lines
450 B
Go
Raw Normal View History

package main
import (
"encoding/json"
"os"
)
type Configuration struct {
ListenAddress string `json:"listen-address"`
Processes []Process `json:"processes"`
}
func LoadConfiguration(path string) (conf *Configuration, err error) {
f, err := os.Open(path)
if err != nil {
return nil, err
}
defer f.Close()
conf = &Configuration{}
if err := json.NewDecoder(f).Decode(conf); err != nil {
return nil, err
}
return conf, nil
}