mirror of
https://github.com/go-gitea/gitea
synced 2026-02-03 11:10:40 +00:00
Refactor template render (#36438)
This commit is contained in:
+5
-6
@@ -22,6 +22,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/process"
|
||||
"code.gitea.io/gitea/modules/public"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/templates"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/routers"
|
||||
"code.gitea.io/gitea/routers/install"
|
||||
@@ -249,12 +250,6 @@ func servePprof() {
|
||||
}
|
||||
|
||||
func runWeb(ctx context.Context, cmd *cli.Command) error {
|
||||
defer func() {
|
||||
if panicked := recover(); panicked != nil {
|
||||
log.Fatal("PANIC: %v\n%s", panicked, log.Stack(2))
|
||||
}
|
||||
}()
|
||||
|
||||
if subCmdName, valid := isValidDefaultSubCommand(cmd); !valid {
|
||||
return fmt.Errorf("unknown command: %s", subCmdName)
|
||||
}
|
||||
@@ -274,6 +269,10 @@ func runWeb(ctx context.Context, cmd *cli.Command) error {
|
||||
createPIDFile(cmd.String("pid"))
|
||||
}
|
||||
|
||||
// init the HTML renderer and load templates, if error happens, it will report the error immediately and exit with error log
|
||||
// in dev mode, it won't exit, but watch the template files for changes
|
||||
_ = templates.PageRenderer()
|
||||
|
||||
if !setting.InstallLock {
|
||||
if err := serveInstall(cmd); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user