mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
23 lines
536 B
Go
23 lines
536 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"net/http"
|
|
|
|
"github.com/lyx0/nourybot/internal/common"
|
|
"github.com/lyx0/nourybot/pkg/humanize"
|
|
)
|
|
|
|
func (app *application) statusPage() {
|
|
commit := common.GetVersion()
|
|
botUptime := humanize.Time(common.GetUptime())
|
|
|
|
statusHandler := func(w http.ResponseWriter, req *http.Request) {
|
|
io.WriteString(w, fmt.Sprintf("up\nlast restart: %v\nenv: %v\ncommit: %v", botUptime, app.Environment, commit))
|
|
}
|
|
|
|
http.HandleFunc("/status", statusHandler)
|
|
app.Log.Fatal(http.ListenAndServe(":8080", nil))
|
|
}
|