mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
Add debug flag; warning label for debug mode
This commit is contained in:
parent
6366239ec4
commit
ec7609ed8c
@ -147,7 +147,8 @@
|
||||
"required": false,
|
||||
"requires_restart": true,
|
||||
"type": "bool",
|
||||
"value": false
|
||||
"value": false,
|
||||
"description": "Enables debug logging and exposes pprof as a route (Don't use in production!)"
|
||||
},
|
||||
"contact_message": {
|
||||
"name": "Contact message",
|
||||
|
@ -184,7 +184,8 @@
|
||||
"required": false,
|
||||
"requires_restart": true,
|
||||
"type": "bool",
|
||||
"value": false
|
||||
"value": false,
|
||||
"description": "Enables debug logging and exposes pprof as a route (Don't use in production!)"
|
||||
},
|
||||
"contact_message": {
|
||||
"name": "Contact message",
|
||||
|
7
main.go
7
main.go
@ -108,6 +108,7 @@ func main() {
|
||||
configPath := flag.String("config", app.config_path, "alternate path to config file.")
|
||||
host := flag.String("host", "", "alternate address to host web ui on.")
|
||||
port := flag.Int("port", 0, "alternate port to host web ui on.")
|
||||
debug := flag.Bool("debug", false, "Enables debug logging and exposes pprof.")
|
||||
|
||||
flag.Parse()
|
||||
if app.config_path == *configPath && app.data_path != *dataPath {
|
||||
@ -164,8 +165,12 @@ func main() {
|
||||
}
|
||||
app.version = app.config.Section("jellyfin").Key("version").String()
|
||||
|
||||
debugMode = app.config.Section("ui").Key("debug").MustBool(true)
|
||||
debugMode = app.config.Section("ui").Key("debug").MustBool(false)
|
||||
if *debug {
|
||||
debugMode = true
|
||||
}
|
||||
if debugMode {
|
||||
app.info.Println("WARNING: Don't use debug mode in production, as it exposes pprof on the network.")
|
||||
app.debug = log.New(os.Stdout, "[DEBUG] ", log.Ltime|log.Lshortfile)
|
||||
} else {
|
||||
app.debug = log.New(ioutil.Discard, "", 0)
|
||||
|
Loading…
Reference in New Issue
Block a user