main.go 761 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * @description:
  3. * @Author: CP
  4. * @Date: 2020-08-23 21:32:48
  5. * @FilePath: \construction_management\web\main.go
  6. */
  7. package main
  8. import (
  9. "fmt"
  10. "go.mod/bootstrap"
  11. "go.mod/conf"
  12. "go.mod/web/middleware/identity"
  13. "go.mod/web/routes"
  14. )
  15. var port = 6060
  16. func newApp() *bootstrap.Bootstrapper {
  17. // 初始化应用
  18. app := bootstrap.New("工程建设项目系统", "纵横软件")
  19. app.Bootstrap()
  20. //, csrf.Configure
  21. app.Configure(identity.Configure, routes.Configure)
  22. return app
  23. }
  24. func main() {
  25. // 服务器集群的时候才需要区分这项设置
  26. // 比如:根据服务器的IP、名称、端口号等,或者运行的参数
  27. if port == 6060 {
  28. conf.RunningCrontabService = true
  29. }
  30. app := newApp()
  31. app.Listen(fmt.Sprintf(":%d", port))
  32. }