blob: 991797d4da8cc76a862679cae6e94f71d9bd0047 [file] [log] [blame]
package main
import (
"net/http"
"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)
}