OLD | NEW |
1 package main | 1 package main |
2 | 2 |
3 import ( | 3 import ( |
4 "encoding/json" | 4 "encoding/json" |
5 "flag" | 5 "flag" |
6 "fmt" | 6 "fmt" |
7 ehtml "html" | 7 ehtml "html" |
8 "html/template" | 8 "html/template" |
9 "math/rand" | 9 "math/rand" |
10 "net" | 10 "net" |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 w.Header().Add("Cache-Control", string(300)) | 995 w.Header().Add("Cache-Control", string(300)) |
996 fileServer.ServeHTTP(w, r) | 996 fileServer.ServeHTTP(w, r) |
997 } | 997 } |
998 } | 998 } |
999 | 999 |
1000 func main() { | 1000 func main() { |
1001 flag.Parse() | 1001 flag.Parse() |
1002 flags.Log() | 1002 flags.Log() |
1003 | 1003 |
1004 Init() | 1004 Init() |
1005 » db.Init() | 1005 » db.Init(db.ProdConnectionString(*local)) |
1006 stats.Start(nanoTileStore, git) | 1006 stats.Start(nanoTileStore, git) |
1007 alerting.Start(nanoTileStore, *apikey) | 1007 alerting.Start(nanoTileStore, *apikey) |
1008 login.Init(*local) | 1008 login.Init(*local) |
1009 glog.Infoln("Begin loading data.") | 1009 glog.Infoln("Begin loading data.") |
1010 | 1010 |
1011 // Resources are served directly. | 1011 // Resources are served directly. |
1012 http.HandleFunc("/res/", autogzip.HandleFunc(makeResourceHandler())) | 1012 http.HandleFunc("/res/", autogzip.HandleFunc(makeResourceHandler())) |
1013 | 1013 |
1014 http.HandleFunc("/", autogzip.HandleFunc(mainHandler)) | 1014 http.HandleFunc("/", autogzip.HandleFunc(mainHandler)) |
1015 http.HandleFunc("/shortcuts/", shortcutHandler) | 1015 http.HandleFunc("/shortcuts/", shortcutHandler) |
(...skipping 12 matching lines...) Expand all Loading... |
1028 http.HandleFunc("/compare/", autogzip.HandleFunc(compareHandler)) | 1028 http.HandleFunc("/compare/", autogzip.HandleFunc(compareHandler)) |
1029 http.HandleFunc("/calc/", autogzip.HandleFunc(calcHandler)) | 1029 http.HandleFunc("/calc/", autogzip.HandleFunc(calcHandler)) |
1030 http.HandleFunc("/help/", autogzip.HandleFunc(helpHandler)) | 1030 http.HandleFunc("/help/", autogzip.HandleFunc(helpHandler)) |
1031 http.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) | 1031 http.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) |
1032 http.HandleFunc("/logout/", login.LogoutHandler) | 1032 http.HandleFunc("/logout/", login.LogoutHandler) |
1033 http.HandleFunc("/loginstatus/", login.StatusHandler) | 1033 http.HandleFunc("/loginstatus/", login.StatusHandler) |
1034 | 1034 |
1035 glog.Infoln("Ready to serve.") | 1035 glog.Infoln("Ready to serve.") |
1036 glog.Fatal(http.ListenAndServe(*port, nil)) | 1036 glog.Fatal(http.ListenAndServe(*port, nil)) |
1037 } | 1037 } |
OLD | NEW |