| 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) |
| } |