mirror of
https://github.com/prometheus/alertmanager
synced 2025-01-26 07:53:26 +00:00
Update API
- Return static silences json - use http.ServeFile
This commit is contained in:
parent
160a549150
commit
54251af063
32
main.go
32
main.go
@ -18,37 +18,15 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
http.HandleFunc("/script.js", func(w http.ResponseWriter, r *http.Request) {
|
||||
f, err := os.Open("dist/script.js")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
fs, err := f.Stat()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
http.ServeContent(w, r, "script.js", fs.ModTime(), f)
|
||||
http.ServeFile(w, r, "dist/script.js")
|
||||
})
|
||||
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
f, err := os.Open("index.html")
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
http.ServeFile(w, r, "index.html")
|
||||
})
|
||||
|
||||
fs, err := f.Stat()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
http.ServeContent(w, r, "index", fs.ModTime(), f)
|
||||
http.HandleFunc("/api/v1/silences", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.ServeFile(w, r, "silences.json")
|
||||
})
|
||||
|
||||
// Recompile the elm code whenever a change is detected.
|
||||
|
Loading…
Reference in New Issue
Block a user