Exemplo n.º 1
0
Arquivo: init.go Projeto: jango2015/OJ
func initConfig() {
	engine = models.Engine()
	c, err := config.ReadDefault("conf/misc.conf")
	if err != nil {
		panic(err)
	}
	smtpConfig.Username, err = c.String("smtp", "username")
	if err != nil {
		panic(err)
	}
	smtpConfig.Password, _ = c.String("smtp", "password")
	smtpConfig.Host, _ = c.String("smtp", "host")
	smtpConfig.Addr, _ = c.String("smtp", "address")
	admin, err = c.String("app", "admin")
	if err != nil {
		panic(err)
	}
	c, err = config.ReadDefault("conf/app.conf")
	if err != nil {
		panic(err)
	}
	appAddr, err = c.String("", "http.addr")
	appPort, err = c.String("", "http.port")
	if appAddr == "" || appPort == "" {
		panic("init fail,can not get address and port from conf/misc.conf")
	}
}
Exemplo n.º 2
0
Arquivo: init.go Projeto: jango2015/OJ
func init() {
	engine = models.Engine()
}
Exemplo n.º 3
0
func init() {
	engine = models.Engine()
	//buffer of size 32
	unHandledCodeChan = make(chan []models.Source)
}