Exemplo n.º 1
0
func init() {
	c := conf.NewConfig(ConfigPath)
	host := c.Read("mysql", "host")
	port, _ := strconv.Atoi(c.Read("mysql", "port"))
	user := c.Read("mysql", "user")
	pwd := c.Read("mysql", "pwd")
	dbname := c.Read("mysql", "dbname")
	db, err = mydb.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8", user, pwd, host, port, dbname))
	if err != nil {
		panic(err.Error())
	}
	db.DB.SetMaxOpenConns(100)
	db.DB.SetMaxIdleConns(10)
	db.DB.Ping()
}
Exemplo n.º 2
0
func (s Du114) Init() {
	c := conf.NewConfig(ConfigPath)
	du114_base_url = c.Read("du114", "base_url")
	du114_img_save_path = c.Read("du114", "img_save_path")
	siteName = "du114"
}
Exemplo n.º 3
0
func (s Souutu) Init() {
	c := conf.NewConfig(ConfigPath)
	souutu_base_url = c.Read("souutu", "base_url")
	souutu_img_save_path = c.Read("souutu", "img_save_path")
	siteName = "souutu"
}