General refactor of the cmd package (#3328)

* General refactor of the cmd package

* Address breakage in runCreateUser

* Place "common" functions into cmd.go
This commit is contained in:
Morgan Bazalgette 2018-01-12 23:16:49 +01:00 committed by Kim "BKC" Carlbäcker
parent 079273e2ff
commit 2b52f77e1b
6 changed files with 92 additions and 79 deletions

View file

@ -121,11 +121,9 @@ func runWeb(ctx *cli.Context) error {
}
}
var listenAddr string
if setting.Protocol == setting.UnixSocket {
listenAddr = fmt.Sprintf("%s", setting.HTTPAddr)
} else {
listenAddr = fmt.Sprintf("%s:%s", setting.HTTPAddr, setting.HTTPPort)
listenAddr := setting.HTTPAddr
if setting.Protocol != setting.UnixSocket {
listenAddr += ":" + setting.HTTPPort
}
log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubURL)
@ -135,6 +133,7 @@ func runWeb(ctx *cli.Context) error {
if setting.EnablePprof {
go func() {
log.Info("Starting pprof server on localhost:6060")
log.Info("%v", http.ListenAndServe("localhost:6060", nil))
}()
}