Exemple #1
0
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))
	}
}
Exemple #2
0
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)
}