mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
refactor: project directory structure
This commit is contained in:
parent
c1193a5b8c
commit
e5a5889931
367 changed files with 710 additions and 756 deletions
30
main.go
30
main.go
|
@ -3,14 +3,36 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/0xJacky/Nginx-UI/server"
|
||||
"github.com/0xJacky/Nginx-UI/server/settings"
|
||||
"github.com/0xJacky/Nginx-UI/internal/boot"
|
||||
"github.com/0xJacky/Nginx-UI/internal/logger"
|
||||
"github.com/0xJacky/Nginx-UI/internal/nginx"
|
||||
"github.com/0xJacky/Nginx-UI/internal/upgrader"
|
||||
"github.com/0xJacky/Nginx-UI/router"
|
||||
"github.com/0xJacky/Nginx-UI/settings"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/jpillora/overseer"
|
||||
"github.com/jpillora/overseer/fetcher"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Program(state overseer.State) {
|
||||
defer logger.Sync()
|
||||
|
||||
logger.Infof("Nginx configuration directory: %s", nginx.GetConfPath())
|
||||
|
||||
boot.Kernel()
|
||||
|
||||
if state.Listener != nil {
|
||||
err := http.Serve(state.Listener, router.InitRouter())
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
logger.Info("Server exited")
|
||||
}
|
||||
|
||||
func main() {
|
||||
var confPath string
|
||||
flag.StringVar(&confPath, "config", "app.ini", "Specify the configuration file")
|
||||
|
@ -20,14 +42,14 @@ func main() {
|
|||
|
||||
gin.SetMode(settings.ServerSettings.RunMode)
|
||||
|
||||
r, err := server.GetRuntimeInfo()
|
||||
r, err := upgrader.GetRuntimeInfo()
|
||||
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
overseer.Run(overseer.Config{
|
||||
Program: server.Program,
|
||||
Program: Program,
|
||||
Address: fmt.Sprintf("%s:%s", settings.ServerSettings.HttpHost, settings.ServerSettings.HttpPort),
|
||||
Fetcher: &fetcher.File{Path: r.ExPath},
|
||||
TerminateTimeout: 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue