main.go 869 B

123456789101112131415161718192021222324252627282930313233343536
  1. package main
  2. import (
  3. "flag"
  4. "fmt"
  5. "github.com/0xJacky/Nginx-UI/server"
  6. "github.com/0xJacky/Nginx-UI/server/service"
  7. "github.com/0xJacky/Nginx-UI/server/settings"
  8. "github.com/gin-gonic/gin"
  9. "github.com/jpillora/overseer"
  10. "github.com/jpillora/overseer/fetcher"
  11. "log"
  12. )
  13. func main() {
  14. var confPath string
  15. flag.StringVar(&confPath, "config", "app.ini", "Specify the configuration file")
  16. flag.Parse()
  17. settings.Init(confPath)
  18. gin.SetMode(settings.ServerSettings.RunMode)
  19. r, err := service.GetRuntimeInfo()
  20. if err != nil {
  21. log.Fatalln(err)
  22. }
  23. overseer.Run(overseer.Config{
  24. Program: server.Program,
  25. Address: fmt.Sprintf(":%s", settings.ServerSettings.HttpPort),
  26. Fetcher: &fetcher.File{Path: r.ExPath},
  27. TerminateTimeout: 0,
  28. })
  29. }