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
func init() {
	lg.InitializeLog(lg.DebugStatus, lg.LogOff, 99, "[BookingTeacher]", "/var/log/go/book.log")

	flag.Usage = func() {
		fmt.Fprint(os.Stderr, fmt.Sprintf(usage, os.Args[0]))
	}

	//command-line
	flag.Parse()

	//signal (Debug)
	go signal.StartSignal()

	//cipher
	_, err := enc.NewCryptDefault()
	if err != nil {
		panic(err)
	}

	//config
	conf.New(*tomlPath, true)
	//conf.Cipher()
}