2023-12-10 20:13:06 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/lyx0/nourybot/internal/common"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (app *application) statusPage() {
|
|
|
|
commit := common.GetVersion()
|
2023-12-10 21:04:59 +01:00
|
|
|
started := common.GetUptime().Format("2006-1-2 15:4:5")
|
|
|
|
commitLink := fmt.Sprintf("https://github.com/lyx0/nourybot/commit/%v", common.GetVersionPure())
|
2023-12-10 20:13:06 +01:00
|
|
|
|
|
|
|
statusHandler := func(w http.ResponseWriter, req *http.Request) {
|
2023-12-10 21:04:59 +01:00
|
|
|
io.WriteString(w, fmt.Sprintf("started: \t%v\nenvironment: \t%v\ncommit: \t%v\ngithub: \t%v", started, app.Environment, commit, commitLink))
|
2023-12-10 20:13:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
http.HandleFunc("/status", statusHandler)
|
|
|
|
app.Log.Fatal(http.ListenAndServe(":8080", nil))
|
|
|
|
}
|