Пример #1
0
func SetDockyardMacaron(m *macaron.Macaron) {
	if err := db.RegisterDriver(setting.DBDriver); err != nil {
		fmt.Printf("Register database driver error: %s\n", err.Error())
	} else {
		db.Drv.RegisterModel(new(models.Repository), new(models.Tag), new(models.Image))
		err := db.Drv.InitDB(setting.DBDriver, setting.DBUser, setting.DBPasswd, setting.DBURI, setting.DBName, setting.DBDB)
		if err != nil {
			fmt.Printf("Connect database error: %s\n", err.Error())
		}
	}

	backend.InitBackend()

	if err := middleware.Initfunc(); err != nil {
		fmt.Printf("Init middleware error: %s\n", err.Error())
	}

	//Setting Middleware
	middleware.SetMiddlewares(m)

	//Setting Router
	router.SetRouters(m)

	//Start Object Storage Service if sets in conf
	if strings.EqualFold(setting.OssSwitch, "enable") {
		ossobj := oss.Instance()
		ossobj.StartOSS()
	}

}
Пример #2
0
func SetDockyardMacaron(m *macaron.Macaron) {
	//Setting Database
	if err := db.InitDB(setting.DBURI, setting.DBPasswd, setting.DBDB); err != nil {
		fmt.Printf("Connect Database error %s", err.Error())
	}

	if err := backend.InitBackend(); err != nil {
		fmt.Printf("Init backend error %s", err.Error())
	}

	if err := middleware.Initfunc(); err != nil {
		fmt.Printf("Init middleware error %s", err.Error())
	}

	//Setting Middleware
	middleware.SetMiddlewares(m)

	//Start Object Storage Service if sets in conf
	if strings.EqualFold(setting.OssSwitch, "enable") {
		ossobj := oss.Instance()
		ossobj.StartOSS()
	}

	//Setting Router
	router.SetRouters(m)

}