feat: new command line options

This commit is contained in:
Hintay 2025-02-03 00:19:02 +09:00
parent 4e6b2daf0d
commit 4239a89d66
No known key found for this signature in database
GPG key ID: 120FC7FF121F2F2D
4 changed files with 53 additions and 8 deletions

15
main.go
View file

@ -1,22 +1,23 @@
package main
import (
"flag"
"errors"
"fmt"
"net/http"
"time"
"github.com/0xJacky/Nginx-UI/internal/cmd"
"github.com/0xJacky/Nginx-UI/internal/kernel"
"github.com/0xJacky/Nginx-UI/model"
"github.com/0xJacky/Nginx-UI/router"
"github.com/0xJacky/Nginx-UI/settings"
"github.com/gin-gonic/gin"
"github.com/jpillora/overseer"
"errors"
"github.com/uozi-tech/cosy"
cKernel "github.com/uozi-tech/cosy/kernel"
"github.com/uozi-tech/cosy/logger"
cRouter "github.com/uozi-tech/cosy/router"
cSettings "github.com/uozi-tech/cosy/settings"
"net/http"
"time"
)
func Program(confPath string) func(state overseer.State) {
@ -58,12 +59,10 @@ func Program(confPath string) func(state overseer.State) {
}
func main() {
var confPath string
flag.StringVar(&confPath, "config", "app.ini", "Specify the configuration file")
flag.Parse()
appCmd := cmd.NewAppCmd()
confPath := appCmd.String("config")
settings.Init(confPath)
overseer.Run(overseer.Config{
Program: Program(confPath),
Address: fmt.Sprintf("%s:%d", cSettings.ServerSettings.Host, cSettings.ServerSettings.Port),