func main() { database.NewDatabase("", "") websocket.NewServer() go runner.Runner() router := web.Routes() config := database.GetConfig() if config.Cert != "" { log.Fatalln(http.ListenAndServeTLS(port(), config.Cert, config.Key, router)) } else { log.Fatalln(http.ListenAndServe(port(), router)) } }
func viewAdminUpdateConfig(w http.ResponseWriter, r *http.Request) { template := "config/admin/update.html" ctx := make(responseContext) if r.Method == "POST" { err := configAdminForm{}.update(r) if err == nil { ctx["message"] = "Update successful." } else { ctx["error"] = err.Error() } } config := database.GetConfig() ctx["config"] = config render(w, r, template, ctx) }