From 92c5e1e4d073c82e12e26170379cb5c8d90ab2e8 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 6 Apr 2021 16:46:05 +0200 Subject: Added trainStop config parameter which was wrongly hardcoded --- internal/webui/app.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'internal') diff --git a/internal/webui/app.go b/internal/webui/app.go index f510074..f6082dc 100644 --- a/internal/webui/app.go +++ b/internal/webui/app.go @@ -14,6 +14,9 @@ import ( // the api client object var client *navitia_api_client.Client +// the webui configuration +var conf *config.Config + //go:embed html/* var templatesFS embed.FS @@ -35,7 +38,7 @@ type Departure struct { func rootHandler(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/" { var p Page - if d, err := client.GetDepartures(); err != nil { + if d, err := client.GetDepartures(conf.TrainStop); err != nil { log.Printf("%+v\n%s\n", d, err) } else { for i := 0; i < len(d.Departures); i++ { @@ -64,6 +67,7 @@ func renderTemplate(w http.ResponseWriter, tmpl string, p Page) { } func Run(c *config.Config) { + conf = c client = navitia_api_client.NewClient(c.Token) http.Handle("/static/", http.FileServer(http.FS(staticFS))) http.HandleFunc("/", rootHandler) -- cgit v1.2.3