示例#1
0
文件: main.go 项目: zhdtty/mornsail
func main() {
	//	flag.Parse()
	//console.Init()
	config.Parse()
	golog.SetLevel(golog.LevelDebug)

	srvModule := NewServer()
	srvModule.Start()
	golog.Info("main", "main", "Starting server", "addr", *config.FLAG_ADDR)

	c := make(chan os.Signal, 1)
	signal.Notify(c,
		syscall.SIGHUP,
		syscall.SIGINT,
		syscall.SIGTERM,
		syscall.SIGQUIT,
		syscall.SIGKILL)
	//	signal.Notify(c, os.Interrupt, os.Kill)

	sig := <-c
	golog.Info("main", "main", "Server begin close", "sig", sig)

	golog.Info("main", "main", "Closing server module ...")
	srvModule.Close()

	golog.Info("main", "main", "Server close success")
}
示例#2
0
func TestParse(t *testing.T) {
	conf, err := config.Parse("../../config/config.json")
	if err != nil {
		t.Error("Expected nil and got error " + err.Error())
	}
	if conf.Servicename != "file" {
		t.Error("Expected file and got " + conf.Servicename)
	}
	if conf.Algorithm.Name != "randomized" {
		t.Error("Expected randomized and got " + conf.Algorithm.Name)
	}
}