1
0

main.go 771 B

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