예제 #1
0
파일: server.go 프로젝트: lfbrock/platform
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)
}
예제 #2
0
func NewServer() {

	l4g.Info("Server is initializing...")

	Srv = &Server{}
	Srv.Store = store.NewSqlStore()

	Srv.Router = mux.NewRouter()
	Srv.Router.NotFoundHandler = http.HandlerFunc(Handle404)
}
예제 #3
0
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)
}
예제 #4
0
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)
}
예제 #5
0
func InitStores() {
	Srv.Store = store.NewSqlStore()
}