add more stuff to api
This commit is contained in:
parent
eaf0a60192
commit
5023155190
@ -3,6 +3,7 @@ package feta
|
|||||||
import "time"
|
import "time"
|
||||||
import "net/http"
|
import "net/http"
|
||||||
import "encoding/json"
|
import "encoding/json"
|
||||||
|
import "runtime"
|
||||||
|
|
||||||
import "github.com/gin-gonic/gin"
|
import "github.com/gin-gonic/gin"
|
||||||
|
|
||||||
@ -38,11 +39,17 @@ func (a *FetaAPIServer) getIndexHandler() http.HandlerFunc {
|
|||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
index := &gin.H{
|
index := &gin.H{
|
||||||
"page": "index",
|
|
||||||
"instances": a.instances(),
|
"instances": a.instances(),
|
||||||
"status": "ok",
|
"server": &gin.H{
|
||||||
"now": time.Now().UTC().Format(time.RFC3339),
|
"now": time.Now().UTC().Format(time.RFC3339),
|
||||||
"uptime": a.feta.Uptime().String(),
|
"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)
|
json, err := json.Marshal(index)
|
||||||
|
Loading…
Reference in New Issue
Block a user