summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2023-05-22 17:51:40 +0200
committerGitHub <noreply@github.com>2023-05-22 23:51:40 +0800
commit3588edbb08f93aaa56defa82dffdbb202cd9aa4a (patch)
treead3b571f18534d3932642d3c069c495a31e9966c /cmd
parent922c83eea3407746a0472e5e3ad8b78a3136c661 (diff)
downloadgitea-3588edbb08f93aaa56defa82dffdbb202cd9aa4a.tar.gz
gitea-3588edbb08f93aaa56defa82dffdbb202cd9aa4a.zip
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.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/manager.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/cmd/manager.go b/cmd/manager.go
index 3f1e223190..2024d5ebbd 100644
--- a/cmd/manager.go
+++ b/cmd/manager.go
@@ -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()