func NewServer() { l4g.Info(utils.T("api.server.new_server.init.info")) Srv = &Server{} Srv.Store = store.NewSqlStore() Srv.Router = mux.NewRouter() Srv.Router.NotFoundHandler = http.HandlerFunc(Handle404) }
func NewServer() { l4g.Info("Server is initializing...") Srv = &Server{} Srv.Store = store.NewSqlStore() Srv.Router = mux.NewRouter() Srv.Router.NotFoundHandler = http.HandlerFunc(Handle404) }
func recycleDatabaseConnection(c *Context, w http.ResponseWriter, r *http.Request) { oldStore := Srv.Store l4g.Warn(utils.T("api.admin.recycle_db_start.warn")) Srv.Store = store.NewSqlStore() time.Sleep(20 * time.Second) oldStore.Close() l4g.Warn(utils.T("api.admin.recycle_db_end.warn")) w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") ReturnStatusOK(w) }
func NewServer(enableProfiler bool) { l4g.Info(utils.T("api.server.new_server.init.info")) Srv = &Server{} Srv.Store = store.NewSqlStore() Srv.Router = mux.NewRouter() if enableProfiler { AttachProfiler(Srv.Router) l4g.Info("Enabled HTTP Profiler") } Srv.Router.NotFoundHandler = http.HandlerFunc(Handle404) }
func InitStores() { Srv.Store = store.NewSqlStore() }