jupyter.go 725 B

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