main.go 664 B

12345678910111213141516171819202122232425262728
  1. package main
  2. import (
  3. "flag"
  4. "github.com/hwholiday/gid/v2/configs"
  5. "github.com/hwholiday/gid/v2/library/log"
  6. "github.com/hwholiday/gid/v2/library/tool"
  7. "github.com/hwholiday/gid/v2/server/grpc"
  8. "github.com/hwholiday/gid/v2/service"
  9. )
  10. func main() {
  11. flag.Parse()
  12. if err := configs.Init(); err != nil {
  13. panic(err)
  14. }
  15. log.NewLogger(configs.Conf.Log)
  16. s := service.NewService(configs.Conf)
  17. grpc.Init(configs.Conf, s)
  18. if err := tool.InitMasterNode(configs.Conf.Etcd, configs.Conf.Server.Addr, 30); err != nil {
  19. panic(err)
  20. }
  21. tool.QuitSignal(func() {
  22. s.Close()
  23. tool.MasterNode.CloseApplyMasterNode()
  24. log.GetLogger().Info("gid exit success")
  25. })
  26. }