Esempio n. 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()
	}

}
Esempio n. 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)

}
Esempio n. 3
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)

	//Setting Router
	router.SetRouters(m)
}
Esempio n. 4
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)

	//Setting Router
	router.SetRouters(m)

	//Create acpool to store aci/asc/pubkey
	err := func() error {
		acpoolname := setting.ImagePath + "/acpool"
		if _, err := os.Stat(acpoolname); err == nil {
			return nil
		}

		if err := os.Mkdir(acpoolname, 0755); err != nil {
			return err
		}
		return nil
	}()
	if err != nil {
		fmt.Printf("Create acpool for rkt failed %s", err.Error())
	}
}