示例#1
0
文件: beego.go 项目: voicedata/beego
func Run() {
	//if AppConfigPath not In the conf/app.conf reParse config
	if AppConfigPath != path.Join(AppPath, "conf", "app.conf") {
		err := ParseConfig()
		if err != nil {
			if RunMode == "dev" {
				Warn(err)
			}
		}
	}

	if SessionOn {
		GlobalSessions, _ = session.NewManager(SessionProvider, SessionName, SessionGCMaxLifetime, SessionSavePath, HttpTLS)
		go GlobalSessions.GC()
	}

	err := BuildTemplate(ViewsPath)
	if err != nil {
		if RunMode == "dev" {
			Warn(err)
		}
	}

	middleware.VERSION = VERSION
	middleware.AppName = AppName
	middleware.RegisterErrorHander()

	BeeApp.Run()
}
示例#2
0
文件: beego.go 项目: someone1/beegae
// Run beego application.
// it's alias of App.Run.
func Run() {
	// if AppConfigPath not In the conf/app.conf reParse config
	if AppConfigPath != filepath.Join(AppPath, "conf", "app.conf") {
		err := ParseConfig()
		if err != nil {
			// configuration is critical to app, panic here if parse failed
			panic(err)
		}
	}

	//init mime
	initMime()

	if SessionOn {
		GlobalSessions, _ = session.NewManager(SessionProvider,
			SessionName,
			SessionGCMaxLifetime,
			SessionSavePath,
			HttpTLS,
			SessionHashFunc,
			SessionHashKey,
			SessionCookieLifeTime)
		go GlobalSessions.GC()
	}

	err := BuildTemplate(ViewsPath)
	if err != nil {
		if RunMode == "dev" {
			Warn(err)
		}
	}

	middleware.VERSION = VERSION
	middleware.AppName = AppName
	middleware.RegisterErrorHander()

	if EnableAdmin {
		go BeeAdminApp.Run()
	}

	BeeApp.Run()
}