authbff.go 615 B

123456789101112131415161718192021222324252627282930
  1. package main
  2. import (
  3. "flag"
  4. "fmt"
  5. "ylink/bff/authbff/api/internal/config"
  6. "ylink/bff/authbff/api/internal/handler"
  7. "ylink/bff/authbff/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/authbff.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. }