1
Fork 0

Add gitea manager reload-templates command (#24843)

This can be useful to update custom templates in production mode, when
they are updated frequently and a full Gitea restart each time is
disruptive.
This commit is contained in:
Brecht Van Lommel 2023-05-22 17:51:40 +02:00 committed by GitHub
parent 922c83eea3
commit 3588edbb08
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 3 deletions

View file

@ -21,6 +21,7 @@ var (
Subcommands: []cli.Command{
subcmdShutdown,
subcmdRestart,
subcmdReloadTemplates,
subcmdFlushQueues,
subcmdLogging,
subCmdProcesses,
@ -46,6 +47,16 @@ var (
},
Action: runRestart,
}
subcmdReloadTemplates = cli.Command{
Name: "reload-templates",
Usage: "Reload template files in the running process",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "debug",
},
},
Action: runReloadTemplates,
}
subcmdFlushQueues = cli.Command{
Name: "flush-queues",
Usage: "Flush queues in the running process",
@ -115,6 +126,15 @@ func runRestart(c *cli.Context) error {
return handleCliResponseExtra(extra)
}
func runReloadTemplates(c *cli.Context) error {
ctx, cancel := installSignals()
defer cancel()
setup(ctx, c.Bool("debug"))
extra := private.ReloadTemplates(ctx)
return handleCliResponseExtra(extra)
}
func runFlushQueues(c *cli.Context) error {
ctx, cancel := installSignals()
defer cancel()