Example #1
0
File: base.go Project: grr89/hrkb
func CtrlInit() {

	staticDir = beego.AppConfig.String("staticDir")

	CandDateFmt = beego.AppConfig.String("comments::cand_date_format")
	TrashDateFmt = beego.AppConfig.String("comments::trash_date_format")
	gitlabUrl = beego.AppConfig.String("gitlab::url")
	gitlabProject = beego.AppConfig.String("gitlab::project")

	beego.AddFuncMap("urlFor", beego.UrlFor)
	beego.AddFuncMap("js", js)
	beego.AddFuncMap("css", css)
	beego.AddFuncMap("kb", kb)
	beego.AddFuncMap("isImg", isImg)
	beego.AddFuncMap("cutStr", CutLongText)
	beego.AddFuncMap("urlContain", urlContain)
	beego.AddFuncMap("T", i18n.IdentityTfunc)
	beego.AddFuncMap("floatStr", floatToString)

	DM = M.GetDM()

	// init notify service
	initNotifyService()
	initBot()

}
Example #2
0
func init() {
	c, err := beeconf.NewConfig("ini", "../../conf/app.conf")

	if err != nil {
		log.Fatal(err)
	}

	TestConfig, err := conf.Initialize("test", c)
	if err != nil {
		log.Fatal(err)
	}

	if err := M.DbOpen(TestConfig.Db); err != nil {
		log.Fatal(err)
	}

	M.PrepareTables(&M.Mail{})
	db = M.GetDM()
	Tfn, _ := i18n.Tfunc("en-us", "en-us", "en-us")
	M.T = Tfn

	mailSt = MailStore{db, 3}
}