| package main |
| |
| import ( |
| "flag" |
| "io/ioutil" |
| |
| "github.com/golang/glog" |
| "github.com/golang/protobuf/proto" |
| |
| confpb "code.hackerspace.pl/q3k/topo/proto/config" |
| ) |
| |
| var ( |
| flagConfigPath string |
| ) |
| |
| func init() { |
| flag.Set("logtostderr", "true") |
| } |
| |
| func main() { |
| flag.StringVar(&flagConfigPath, "config_path", "./topo.pb.text", "Text proto configuration of Topo (per config.proto)") |
| flag.Parse() |
| |
| data, err := ioutil.ReadFile(flagConfigPath) |
| if err != nil { |
| glog.Exitf("Could not read config: %v", err) |
| } |
| |
| config := confpb.Config{} |
| proto.UnmarshalText(string(data), &config) |
| glog.Infof("%+v", config) |
| } |