func init() { cmd, err := notify.NewCmd("telegram-cli", "-C") if err != nil { log.Fatal("NewCmd error", err) } botConf = Conf{ Limit: 10, Url: "localhost", Rpms: 500, Cmd: cmd, } //Init Data Mapper 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.Cand{}) Tfn, _ := i18n.Tfunc("en-us", "en-us", "en-us") M.T = Tfn }
func init() { var err error // read main config file AppConfig, err = conf.Initialize(beego.AppConfig.String("runmode"), beego.AppConfig) if err != nil { log.Fatal(err) } // Open connection to DB and pass connection to DataMapper if err := M.DbOpen(AppConfig.Db); err != nil { log.Fatal(err) } // Register and Prepare app models in our DataMapper M.PrepareTables(&M.User{}, &M.Cand{}, &M.Rat{}, &M.Crit{}, &M.Dep{}, &M.Comment{}, &M.Role{}, &M.File{}, &M.Contact{}, &M.Mail{}, &M.Lang{}) if err := logger.Initialize(AppConfig.Log); err != nil { log.Fatal(err) } }
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} }