Refactor start-up parameters. Fixed embed bugs for Windows. Fixed wrong Content Type of .js file on some OS platforms.

This commit is contained in:
Hintay 2022-02-19 00:46:46 +08:00
parent 0cf6919d7b
commit 759a235e7e
No known key found for this signature in database
GPG key ID: 120FC7FF121F2F2D
6 changed files with 47 additions and 41 deletions

11
main.go
View file

@ -8,6 +8,7 @@ import (
"github.com/0xJacky/Nginx-UI/server/settings"
tool2 "github.com/0xJacky/Nginx-UI/server/tool"
"log"
"mime"
"net/http"
"os/signal"
"syscall"
@ -19,11 +20,15 @@ func main() {
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()
var dataDir string
flag.StringVar(&dataDir, "d", ".", "Specify the data dir")
// Hack: fix wrong Content Type of .js file on some OS platforms
// See https://github.com/golang/go/issues/32350
_ = mime.AddExtensionType(".js", "text/javascript; charset=utf-8")
var confPath string
flag.StringVar(&confPath, "config", "./app.ini", "Specify the configuration file")
flag.Parse()
settings.Init(dataDir)
settings.Init(confPath)
model.Init()
srv := &http.Server{