mirkoify
diff --git a/main.go b/main.go
index 87675bc..bbaba70 100644
--- a/main.go
+++ b/main.go
@@ -7,6 +7,7 @@
"flag"
"io/ioutil"
+ "code.hackerspace.pl/q3k/mirko"
"github.com/digitalocean/go-netbox/netbox"
"github.com/digitalocean/go-netbox/netbox/client"
"github.com/golang/glog"
@@ -22,7 +23,6 @@
flagConfigPath string
flagNetboxHost string
flagNetboxAPIKey string
- flagDebugListen string
)
func init() {
@@ -33,9 +33,13 @@
flag.StringVar(&flagConfigPath, "config_path", "./topo.pb.text", "Text proto configuration of Topo (per config.proto)")
flag.StringVar(&flagNetboxHost, "netbox_host", "netbox.bgp.wtf", "Netbox host")
flag.StringVar(&flagNetboxAPIKey, "netbox_api_key", "", "Netbox API key")
- flag.StringVar(&flagDebugListen, "debug_listen", "127.0.0.1:42001", "Debug HTTP listen address")
flag.Parse()
+ m := mirko.New()
+ if err := m.Listen(); err != nil {
+ glog.Exitf("Listen(): %v", err)
+ }
+
ctx := context.Background()
data, err := ioutil.ReadFile(flagConfigPath)
@@ -65,9 +69,12 @@
glog.Exitf("Initial netbox feed failed: %v", err)
}
- sconf := ServiceConfig{
- DebugListen: flagDebugListen,
+ s := NewService(gr, stm)
+ s.Setup(m)
+
+ if err := m.Serve(); err != nil {
+ glog.Exitf("Serve(): %v", err)
}
- srv := NewService(gr, stm, sconf)
- srv.Run()
+
+ select {}
}