Exemple #1
0
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)
}
Exemple #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)
}
Exemple #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)
}
Exemple #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)
}
Exemple #5
0
func InitStores() {
	Srv.Store = store.NewSqlStore()
}