From 50231551907987d43a31b48751486af3eb313422 Mon Sep 17 00:00:00 2001 From: Jeffrey Paul Date: Tue, 5 Nov 2019 17:21:30 -0800 Subject: [PATCH] add more stuff to api --- apihandlers.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/apihandlers.go b/apihandlers.go index 9a0e675..32c66df 100644 --- a/apihandlers.go +++ b/apihandlers.go @@ -3,6 +3,7 @@ package feta import "time" import "net/http" import "encoding/json" +import "runtime" import "github.com/gin-gonic/gin" @@ -38,11 +39,17 @@ func (a *FetaAPIServer) getIndexHandler() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { index := &gin.H{ - "page": "index", "instances": a.instances(), - "status": "ok", - "now": time.Now().UTC().Format(time.RFC3339), - "uptime": a.feta.Uptime().String(), + "server": &gin.H{ + "now": time.Now().UTC().Format(time.RFC3339), + "uptime": a.feta.Uptime().String(), + "goroutines": runtime.NumGoroutine(), + "goversion": runtime.Version(), + "version": a.feta.version, + "buildtime": a.feta.buildtime, + "buildarch": a.feta.buildarch, + "builduser": a.feta.builduser, + }, } json, err := json.Marshal(index)