diff --git a/config.yml b/config.yml index a808d58..ef5e15c 100644 --- a/config.yml +++ b/config.yml @@ -3,7 +3,7 @@ http: checks: hdd: - max_percent: 100 + max_percent: 90 load: max_load_1: 10 max_load_5: 8 diff --git a/main.go b/main.go index 15e40c6..f28143b 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + _ "embed" "encoding/json" "github.com/rs/zerolog/log" checks "http-server-status/internal/pkg/checks" @@ -8,6 +9,9 @@ import ( "sync" ) +//go:embed template/index.html +var s string + var checkList []checks.Check func init() { @@ -19,7 +23,7 @@ func init() { func main() { http.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) { - http.Redirect(writer, request, "/data.json", http.StatusSeeOther) + writer.Write([]byte(s)) }) http.HandleFunc("/data.json", handler) err := http.ListenAndServe(c.HTTP.Listen, nil) @@ -47,6 +51,7 @@ func handler(w http.ResponseWriter, r *http.Request) { } + type ResultReturn struct { Success bool `json:"success"` Data interface{} `json:"data"` diff --git a/template/index.html b/template/index.html new file mode 100644 index 0000000..1263782 --- /dev/null +++ b/template/index.html @@ -0,0 +1,86 @@ + +
+ + + + + + ++ HDD 1: +
Some quick example text to build on the card title and make up the bulk of the card's content.
+