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 1031 matching lines...) Loading... |
1042 fileServer := http.FileServer(http.Dir("./")) | 1042 fileServer := http.FileServer(http.Dir("./")) |
1043 return func(w http.ResponseWriter, r *http.Request) { | 1043 return func(w http.ResponseWriter, r *http.Request) { |
1044 w.Header().Add("Cache-Control", string(300)) | 1044 w.Header().Add("Cache-Control", string(300)) |
1045 fileServer.ServeHTTP(w, r) | 1045 fileServer.ServeHTTP(w, r) |
1046 } | 1046 } |
1047 } | 1047 } |
1048 | 1048 |
1049 func main() { | 1049 func main() { |
1050 flag.Parse() | 1050 flag.Parse() |
1051 flags.Log() | 1051 flags.Log() |
| 1052 defer glog.Flush() |
1052 | 1053 |
1053 Init() | 1054 Init() |
1054 db.Init(db.ProdDatabaseConfig(*local)) | 1055 db.Init(db.ProdDatabaseConfig(*local)) |
1055 stats.Start(nanoTileStore, git) | 1056 stats.Start(nanoTileStore, git) |
1056 alerting.Start(nanoTileStore, *apikey) | 1057 alerting.Start(nanoTileStore, *apikey) |
1057 | 1058 |
1058 // By default use a set of credentials setup for localhost access. | 1059 // By default use a set of credentials setup for localhost access. |
1059 var cookieSalt = "notverysecret" | 1060 var cookieSalt = "notverysecret" |
1060 var clientID = "31977622648-1873k0c1e5edaka4adpv1ppvhr5id3qm.apps.google
usercontent.com" | 1061 var clientID = "31977622648-1873k0c1e5edaka4adpv1ppvhr5id3qm.apps.google
usercontent.com" |
1061 var clientSecret = "cw0IosPu4yjaG2KWmppj2guj" | 1062 var clientSecret = "cw0IosPu4yjaG2KWmppj2guj" |
(...skipping 28 matching lines...) Loading... |
1090 http.HandleFunc("/compare/", autogzip.HandleFunc(compareHandler)) | 1091 http.HandleFunc("/compare/", autogzip.HandleFunc(compareHandler)) |
1091 http.HandleFunc("/calc/", autogzip.HandleFunc(calcHandler)) | 1092 http.HandleFunc("/calc/", autogzip.HandleFunc(calcHandler)) |
1092 http.HandleFunc("/help/", autogzip.HandleFunc(helpHandler)) | 1093 http.HandleFunc("/help/", autogzip.HandleFunc(helpHandler)) |
1093 http.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) | 1094 http.HandleFunc("/oauth2callback/", login.OAuth2CallbackHandler) |
1094 http.HandleFunc("/logout/", login.LogoutHandler) | 1095 http.HandleFunc("/logout/", login.LogoutHandler) |
1095 http.HandleFunc("/loginstatus/", login.StatusHandler) | 1096 http.HandleFunc("/loginstatus/", login.StatusHandler) |
1096 | 1097 |
1097 glog.Infoln("Ready to serve.") | 1098 glog.Infoln("Ready to serve.") |
1098 glog.Fatal(http.ListenAndServe(*port, nil)) | 1099 glog.Fatal(http.ListenAndServe(*port, nil)) |
1099 } | 1100 } |
OLD | NEW |