nginx-ui/main.go
2023-05-05 12:47:30 +08:00

36 lines
869 B
Go

package main
import (
"flag"
"fmt"
"github.com/0xJacky/Nginx-UI/server"
"github.com/0xJacky/Nginx-UI/server/service"
"github.com/0xJacky/Nginx-UI/server/settings"
"github.com/gin-gonic/gin"
"github.com/jpillora/overseer"
"github.com/jpillora/overseer/fetcher"
"log"
)
func main() {
var confPath string
flag.StringVar(&confPath, "config", "app.ini", "Specify the configuration file")
flag.Parse()
settings.Init(confPath)
gin.SetMode(settings.ServerSettings.RunMode)
r, err := service.GetRuntimeInfo()
if err != nil {
log.Fatalln(err)
}
overseer.Run(overseer.Config{
Program: server.Program,
Address: fmt.Sprintf(":%s", settings.ServerSettings.HttpPort),
Fetcher: &fetcher.File{Path: r.ExPath},
TerminateTimeout: 0,
})
}