1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 10:07:02 +00:00

Make monitor configurable for #44

This commit is contained in:
James Hillyerd
2017-01-21 19:15:44 -08:00
parent c346372c85
commit 9ae428ca44
11 changed files with 108 additions and 8 deletions

View File

@@ -31,6 +31,12 @@ func RootIndex(w http.ResponseWriter, req *http.Request, ctx *httpd.Context) (er
// RootMonitor serves the Inbucket monitor page
func RootMonitor(w http.ResponseWriter, req *http.Request, ctx *httpd.Context) (err error) {
if !config.GetWebConfig().MonitorVisible {
ctx.Session.AddFlash("Monitor is disabled in configuration", "errors")
_ = ctx.Session.Save(req, w)
http.Redirect(w, req, httpd.Reverse("RootIndex"), http.StatusSeeOther)
return nil
}
// Get flash messages, save session
errorFlash := ctx.Session.Flashes("errors")
if err = ctx.Session.Save(req, w); err != nil {