cmdbff.go 612 B

12345678910111213141516171819202122232425262728293031
  1. package main
  2. import (
  3. "flag"
  4. "fmt"
  5. "ylink/bff/cmdbff/api/internal/config"
  6. "ylink/bff/cmdbff/api/internal/handler"
  7. "ylink/bff/cmdbff/api/internal/svc"
  8. "github.com/zeromicro/go-zero/core/conf"
  9. "github.com/zeromicro/go-zero/rest"
  10. )
  11. var configFile = flag.String("f", "etc/cmdbff.yaml", "the config file")
  12. func main() {
  13. flag.Parse()
  14. var c config.Config
  15. conf.MustLoad(*configFile, &c)
  16. ctx := svc.NewServiceContext(c)
  17. server := rest.MustNewServer(c.RestConf)
  18. defer server.Stop()
  19. handler.RegisterHandlers(server, ctx)
  20. fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
  21. server.Start()
  22. }