move flag parsing to main, add debug mime types
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"proxmoxaas-dashboard/dist/web" // go will complain here until the first build
|
||||
@@ -13,13 +12,10 @@ import (
|
||||
"github.com/tdewolff/minify/v2"
|
||||
)
|
||||
|
||||
func Run() {
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
|
||||
configPath := flag.String("config", "config.json", "path to config.json file")
|
||||
flag.Parse()
|
||||
func Run(configPath *string) {
|
||||
common.Global = common.GetConfig(*configPath)
|
||||
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
router := gin.Default()
|
||||
m := common.InitMinify()
|
||||
ServeStatic(router, m)
|
||||
|
@@ -51,3 +51,41 @@ var MimeTypes = map[string]MimeType{
|
||||
Minifier: nil,
|
||||
},
|
||||
}
|
||||
|
||||
// debug mime types
|
||||
/*
|
||||
var MimeTypes = map[string]MimeType{
|
||||
"css": {
|
||||
Type: "text/css",
|
||||
Minifier: nil,
|
||||
},
|
||||
"html": {
|
||||
Type: "text/html",
|
||||
Minifier: nil,
|
||||
},
|
||||
"tmpl": {
|
||||
Type: "text/plain",
|
||||
Minifier: nil,
|
||||
},
|
||||
"frag": {
|
||||
Type: "text/plain",
|
||||
Minifier: nil,
|
||||
},
|
||||
"svg": {
|
||||
Type: "image/svg+xml",
|
||||
Minifier: nil,
|
||||
},
|
||||
"js": {
|
||||
Type: "application/javascript",
|
||||
Minifier: nil,
|
||||
},
|
||||
"wasm": {
|
||||
Type: "application/wasm",
|
||||
Minifier: nil,
|
||||
},
|
||||
"*": {
|
||||
Type: "text/plain",
|
||||
Minifier: nil,
|
||||
},
|
||||
}
|
||||
*/
|
||||
|
@@ -1,9 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
app "proxmoxaas-dashboard/app"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app.Run()
|
||||
configPath := flag.String("config", "config.json", "path to config.json file")
|
||||
flag.Parse()
|
||||
app.Run(configPath)
|
||||
}
|
||||
|
Reference in New Issue
Block a user