Example #1
0
//-----------------------------------------------------------------------------
// functions
//-----------------------------------------------------------------------------
func checkParam() {
	path := os.Getenv("GOPATH") + "/src/github.com/hiromaily/go-book-teacher/config/mailon.toml"
	conf.New(path, true)

	m := conf.GetConf().Mail

	if m.MailTo == "" || m.MailFrom == "" || m.SMTP.Pass == "" ||
		m.SMTP.Server == "" || m.SMTP.Port == 0 || conf.GetConf().Redis.URL == "" {
		panic("parameter is wrong.")
	}
}
Example #2
0
// Setup is settings for sending mail
func Setup() {
	//get environment variable
	subject := "[ENGLISH LESSON] It's Available."
	body := ""
	//mails
	smt := conf.GetConf().Mail.SMTP
	m := conf.GetConf().Mail

	smtp := ml.SMTP{Address: smt.Address, Pass: smt.Pass,
		Server: smt.Server, Port: smt.Port}

	mi = &ml.Info{ToAddress: []string{m.MailTo}, FromAddress: m.MailFrom,
		Subject: subject, Body: body, SMTP: smtp}
}
Example #3
0
// Setup is settings
func Setup() (*StoreRedis, error) {
	redisURL := conf.GetConf().Redis.URL
	host, pass, port, err := hrk.GetRedisInfo(redisURL)
	if err != nil {
		return nil, err
	}
	rd = StoreRedis{}
	rd.RD = rds.New(host, uint16(port), pass, 0)
	//rd.RD.Connection(0)

	return &rd, nil
}
Example #4
0
//1.setupMain()
func setupMain() {

	//flg
	if conf.GetConf().Redis.URL != "" {
		//Redis
		_, err := rd.Setup()
		if err == nil {
			redisFlg = true
		}
	}
	//saved file
	tt.Setup()

	if conf.GetConf().Mail.MailTo != "" {
		mailFlg = true

		//Mail Check
		ml.Setup()
	}

	//th.SetPrintOn(true)
}
Example #5
0
// Setup is settings
func Setup() {
	if conf.GetConf().StatusFile != "" {
		txt.filePath = conf.GetConf().StatusFile
	}
}