mirror of
https://github.com/trafficlunar/api.git
synced 2026-06-27 22:24:08 +00:00
feat: computer data uptime
also fix last commit
This commit is contained in:
parent
02740548de
commit
84dfe05de8
3 changed files with 13 additions and 4 deletions
|
|
@ -52,12 +52,17 @@ func NewRouter() {
|
|||
// Prometheus
|
||||
r.Handle("/metrics", promhttp.Handler())
|
||||
|
||||
var commit = "unknown"
|
||||
if os.Getenv("SOURCE_COMMIT") != "" {
|
||||
commit = os.Getenv("SOURCE_COMMIT")[:7] // shorten to 7 characters
|
||||
}
|
||||
|
||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(map[string]string{
|
||||
"name": "trafficlunar's api",
|
||||
"url": "https://github.com/trafficlunar/api",
|
||||
"commit": os.Getenv("SOURCE_COMMIT")[:7], // shorten to 7 characters
|
||||
"commit": commit,
|
||||
})
|
||||
})
|
||||
r.Get("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue