Пример #1
0
Файл: main.go Проект: yab/harbor
func main() {

	beego.BConfig.WebConfig.Session.SessionOn = true
	beego.AddTemplateExt("htm")
	dao.InitDB()
	if err := updateInitPassword(adminUserID, os.Getenv("HARBOR_ADMIN_PASSWORD")); err != nil {
		log.Error(err)
	}
	initRouters()
	beego.Run()
}
Пример #2
0
func main() {

	beego.BConfig.WebConfig.Session.SessionOn = true
	//TODO
	redisURL := os.Getenv("_REDIS_URL")
	if len(redisURL) > 0 {
		beego.BConfig.WebConfig.Session.SessionProvider = "redis"
		beego.BConfig.WebConfig.Session.SessionProviderConfig = redisURL
	}
	//
	beego.AddTemplateExt("htm")

	dao.InitDatabase()

	if err := updateInitPassword(adminUserID, config.InitialAdminPassword()); err != nil {
		log.Error(err)
	}
	initRouters()
	if err := api.SyncRegistry(); err != nil {
		log.Error(err)
	}
	beego.Run()
}
Пример #3
0
func init() {

	_, file, _, _ := runtime.Caller(1)
	apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
	beego.BConfig.WebConfig.Session.SessionOn = true
	beego.TestBeegoInit(apppath)
	beego.AddTemplateExt("htm")

	beego.Router("/", &IndexController{})
	beego.Router("/dashboard", &DashboardController{})
	beego.Router("/project", &ProjectController{})
	beego.Router("/repository", &RepositoryController{})
	beego.Router("/sign_up", &SignUpController{})
	beego.Router("/add_new", &AddNewController{})
	beego.Router("/account_setting", &AccountSettingController{})
	beego.Router("/change_password", &ChangePasswordController{})
	beego.Router("/admin_option", &AdminOptionController{})
	beego.Router("/forgot_password", &ForgotPasswordController{})
	beego.Router("/reset_password", &ResetPasswordController{})
	beego.Router("/search", &SearchController{})

	beego.Router("/login", &CommonController{}, "post:Login")
	beego.Router("/log_out", &CommonController{}, "get:LogOut")
	beego.Router("/reset", &CommonController{}, "post:ResetPassword")
	beego.Router("/userExists", &CommonController{}, "post:UserExists")
	beego.Router("/sendEmail", &CommonController{}, "get:SendEmail")
	beego.Router("/language", &CommonController{}, "get:SwitchLanguage")

	beego.Router("/optional_menu", &OptionalMenuController{})
	beego.Router("/navigation_header", &NavigationHeaderController{})
	beego.Router("/navigation_detail", &NavigationDetailController{})
	beego.Router("/sign_in", &SignInController{})

	//Init user Info
	//admin = &usrInfo{adminName, adminPwd}

}
Пример #4
0
func main() {

	m.Connect()
	beego.ViewsPath = "views"
	beego.TemplateLeft = "<<<"
	beego.TemplateRight = ">>>"

	beego.AddTemplateExt("html")
	beego.SetStaticPath("/public", "public")

	beego.SetLogger("file", `{"filename":"logs/finprocess.log"}`)
	beego.SetLogFuncCall(true)

	logLevel, _ := beego.AppConfig.Int("log_level")
	beego.SetLevel(logLevel)

	//minutes for duration
	duration, _ := beego.AppConfig.Int("task_duration")

	go tasks.DailyTaskInit(duration) //启动task

	beego.Run()

}