summaryrefslogtreecommitdiff
path: root/app/main.go
diff options
context:
space:
mode:
authorHorus32015-02-27 04:02:15 +0100
committerHorus32015-02-27 04:02:15 +0100
commit6837ddf68f13a1633ea868ab55d71389ca5bc175 (patch)
tree94fbfabdfa4506eb1b2dbf0067a7c0fa87f294c9 /app/main.go
parent60767a3ea8190d3f070f3aae86c2d72ffb10cfd6 (diff)
downloadstatuspage-6837ddf68f13a1633ea868ab55d71389ca5bc175.tar.gz
Version 0.2. Sends E-Mails now. Also sticky post on index page to quickly inform people. Concatenated all CSS and JavaScript files.
Diffstat (limited to 'app/main.go')
-rw-r--r--app/main.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/app/main.go b/app/main.go
index 6190b1a..f4bddda 100644
--- a/app/main.go
+++ b/app/main.go
@@ -13,9 +13,11 @@ import (
var decoder = schema.NewDecoder()
-var store = sessions.NewCookieStore([]byte(RandomKey()))
+//var store = sessions.NewCookieStore([]byte(RandomKey()))
+var store = sessions.NewCookieStore([]byte(os.Getenv("STATUS_SECRET")))
var mainTempl = template.Must(template.New("global").Funcs(template.FuncMap{"add": add}).ParseGlob("../views/*.html"))
+var emailTempl = template.Must(template.New("email").Funcs(template.FuncMap{"add": add}).ParseGlob("../views/email/*.html"))
var c = cron.New()
@@ -33,8 +35,6 @@ func main() {
checkConfig()
jobRun()
InitDB()
- insertHost()
- insertAdmin()
go func() {
err := FillCache()
if err != nil {
@@ -46,15 +46,19 @@ func main() {
r.HandleFunc("/", IndexHandler)
r.HandleFunc("/login", LoginHandler).Methods("POST")
r.HandleFunc("/login", PrintLoginHandler).Methods("GET")
- r.HandleFunc("/logout", LogoutHandler)
+ r.HandleFunc("/logout", LogoutHandler).Methods("POST")
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./../static"))))
r.HandleFunc("/register", RegisterHandler).Methods("POST")
- r.HandleFunc("/register", PrintRegisterHandler).Methods("GET")
+ //r.HandleFunc("/register", PrintRegisterHandler).Methods("GET")
r.HandleFunc("/new", AddNewJobHandler).Methods("POST")
- r.HandleFunc("/new", PrintNewJobHandler).Methods("GET")
+ //r.HandleFunc("/new", PrintNewJobHandler).Methods("GET")
r.HandleFunc("/refresh", RefreshAllHandler).Methods("POST")
- r.HandleFunc("/jobs", ShowJobHandler)
+ //r.HandleFunc("/jobs", ShowJobHandler)
r.HandleFunc("/admin", AdminHandler)
+ r.HandleFunc("/register", SetupHandler)
+ //r.HandleFunc("/delete", DeleteHandler).Methods("POST")
+ r.HandleFunc("/delete", DeleteHandler)
+ r.HandleFunc("/sticky/new", NewStickyHandler).Methods("POST")
http.Handle("/", r)