add debug server with status page
diff --git a/service.go b/service.go
index ab9e10a..991797d 100644
--- a/service.go
+++ b/service.go
@@ -1,7 +1,33 @@
package main
-import confpb "code.hackerspace.pl/q3k/topo/proto/config"
+import (
+ "net/http"
-type service struct {
- config *confpb.Config
+ "code.hackerspace.pl/q3k/topo/graph"
+ "github.com/golang/glog"
+ _ "github.com/q3k/statusz"
+)
+
+type ServiceConfig struct {
+ DebugListen string
+}
+
+type Service struct {
+ gr *graph.Graph
+ config ServiceConfig
+}
+
+func NewService(gr *graph.Graph, c ServiceConfig) *Service {
+ return &Service{
+ gr: gr,
+ config: c,
+ }
+}
+
+func (s *Service) Run() {
+ http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
+ http.Redirect(w, r, "/debug/status", http.StatusSeeOther)
+ })
+ glog.Infof("Debug listening on %s....", s.config.DebugListen)
+ http.ListenAndServe(s.config.DebugListen, nil)
}