From 41dd3f9f0ce32bdd0c31ea0fba6d547dbe7f3453 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 23 Apr 2017 16:39:24 +0200 Subject: minor web interface fix --- src/hub/src/spreadspace.org/sfive/s5srvWeb.go | 7 ++++--- src/hub/src/spreadspace.org/sfive/s5store.go | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/hub') diff --git a/src/hub/src/spreadspace.org/sfive/s5srvWeb.go b/src/hub/src/spreadspace.org/sfive/s5srvWeb.go index af9e986..eac610e 100644 --- a/src/hub/src/spreadspace.org/sfive/s5srvWeb.go +++ b/src/hub/src/spreadspace.org/sfive/s5srvWeb.go @@ -13,8 +13,9 @@ import ( "github.com/zenazn/goji/web" ) -func hello(c web.C, w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "Hello, %s!", c.URLParams["name"]) +func (self StatsSinkServer) healthz(c web.C, w http.ResponseWriter, r *http.Request) { + // TODO: do a more sophisticated check + fmt.Fprintf(w, "OK\n") } func (self StatsSinkServer) getTagList(c web.C, w http.ResponseWriter, r *http.Request) { @@ -243,7 +244,7 @@ func (self StatsSinkServer) ServeWeb(vizAppLocation string) { } } - goji.Get("/hello/:name", hello) + goji.Get("/healthz", self.healthz) goji.Get("/tags", self.getTagList) goji.Get("/sources", self.getSourcesList) goji.Get("/sources/:id", self.getSource) diff --git a/src/hub/src/spreadspace.org/sfive/s5store.go b/src/hub/src/spreadspace.org/sfive/s5store.go index 6d6a9ad..cd95076 100644 --- a/src/hub/src/spreadspace.org/sfive/s5store.go +++ b/src/hub/src/spreadspace.org/sfive/s5store.go @@ -346,13 +346,13 @@ func (s sqliteStore) AppendMany(updates []StatisticsData) (err error) { func castArrayToString(value []interface{}) []string { res := make([]string, len(value)) for i := range value { - res[i] = value[i].(string) + res[i] = value[i].(*tagDb).Name } return res } func (s sqliteStore) GetTags() ([]string, error) { - res, dbErr := s.db.Select("", "select Name from "+tagsTn) + res, dbErr := s.db.Select(tagDb{}, "select Name from "+tagsTn) if dbErr == nil { sRes := castArrayToString(res) return sRes, nil -- cgit v1.2.3