mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 02:17:54 +01:00
Add debug option to serv to help debug problems (#9492)
* Add debug option to serv to help debug problems * fixup! Add debug option to serv to help debug problems
This commit is contained in:
parent
8b2f29c0d2
commit
3e166bd055
@ -65,7 +65,7 @@ Gitea or set your environment appropriately.`, "")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setup("hooks/pre-receive.log")
|
setup("hooks/pre-receive.log", false)
|
||||||
|
|
||||||
// the environment setted on serv command
|
// the environment setted on serv command
|
||||||
isWiki := (os.Getenv(models.EnvRepoIsWiki) == "true")
|
isWiki := (os.Getenv(models.EnvRepoIsWiki) == "true")
|
||||||
@ -131,7 +131,7 @@ Gitea or set your environment appropriately.`, "")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setup("hooks/update.log")
|
setup("hooks/update.log", false)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ Gitea or set your environment appropriately.`, "")
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setup("hooks/post-receive.log")
|
setup("hooks/post-receive.log", false)
|
||||||
|
|
||||||
// the environment setted on serv command
|
// the environment setted on serv command
|
||||||
repoUser := os.Getenv(models.EnvRepoUsername)
|
repoUser := os.Getenv(models.EnvRepoUsername)
|
||||||
|
@ -62,7 +62,7 @@ func runKeys(c *cli.Context) error {
|
|||||||
return errors.New("No key type and content provided")
|
return errors.New("No key type and content provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
setup("keys.log")
|
setup("keys.log", false)
|
||||||
|
|
||||||
authorizedString, err := private.AuthorizedPublicKeyByContent(content)
|
authorizedString, err := private.AuthorizedPublicKeyByContent(content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
14
cmd/serv.go
14
cmd/serv.go
@ -41,12 +41,20 @@ var CmdServ = cli.Command{
|
|||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "enable-pprof",
|
Name: "enable-pprof",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "debug",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func setup(logPath string) {
|
func setup(logPath string, debug bool) {
|
||||||
_ = log.DelLogger("console")
|
if !debug {
|
||||||
|
_ = log.DelLogger("console")
|
||||||
|
}
|
||||||
setting.NewContext()
|
setting.NewContext()
|
||||||
|
if debug {
|
||||||
|
setting.ProdMode = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseCmd(cmd string) (string, string) {
|
func parseCmd(cmd string) (string, string) {
|
||||||
@ -80,7 +88,7 @@ func fail(userMessage, logMessage string, args ...interface{}) {
|
|||||||
|
|
||||||
func runServ(c *cli.Context) error {
|
func runServ(c *cli.Context) error {
|
||||||
// FIXME: This needs to internationalised
|
// FIXME: This needs to internationalised
|
||||||
setup("serv.log")
|
setup("serv.log", c.Bool("debug"))
|
||||||
|
|
||||||
if setting.SSH.Disabled {
|
if setting.SSH.Disabled {
|
||||||
println("Gitea: SSH has been disabled")
|
println("Gitea: SSH has been disabled")
|
||||||
|
Loading…
Reference in New Issue
Block a user