forked from Cliffbreak/tsviewer
added startup messages
This commit is contained in:
parent
1f23290854
commit
036d6f604c
1 changed files with 7 additions and 0 deletions
7
main.go
7
main.go
|
@ -42,26 +42,33 @@ func Routes(s service.Service, t template.Template) *chi.Mux {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
log.Println("Loading configurations...")
|
||||||
config, err := config.New()
|
config, err := config.New()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
log.Println("Configurations loaded!")
|
||||||
|
|
||||||
|
log.Println("Starting query service...")
|
||||||
service, err := service.New(*config)
|
service, err := service.New(*config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
defer service.TSClient.Close()
|
defer service.TSClient.Close()
|
||||||
|
log.Println("Query service connected to", fmt.Sprintf("%s:%d!", config.ServerTS.IP, config.ServerTS.PortQuery))
|
||||||
|
|
||||||
|
log.Println("Loading templates...")
|
||||||
templates, err := gui.LoadTemplates()
|
templates, err := gui.LoadTemplates()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
log.Println("All templates loaded!")
|
||||||
|
|
||||||
router := Routes(*service, *templates)
|
router := Routes(*service, *templates)
|
||||||
router.Get("/static/*", func(w http.ResponseWriter, r *http.Request) {
|
router.Get("/static/*", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.StripPrefix("/static", http.FileServer(http.Dir("./static"))).ServeHTTP(w, r)
|
http.StripPrefix("/static", http.FileServer(http.Dir("./static"))).ServeHTTP(w, r)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
log.Println("Starting the web server locally on port", config.ServerWeb.Port)
|
||||||
log.Fatal("Handler: ", http.ListenAndServe(fmt.Sprintf(":%d", config.ServerWeb.Port), router))
|
log.Fatal("Handler: ", http.ListenAndServe(fmt.Sprintf(":%d", config.ServerWeb.Port), router))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue