From 3588edbb08f93aaa56defa82dffdbb202cd9aa4a Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 22 May 2023 17:51:40 +0200 Subject: 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. --- modules/private/manager.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'modules/private/manager.go') diff --git a/modules/private/manager.go b/modules/private/manager.go index a974c3ed05..382986bf1d 100644 --- a/modules/private/manager.go +++ b/modules/private/manager.go @@ -29,6 +29,13 @@ func Restart(ctx context.Context) ResponseExtra { return requestJSONClientMsg(req, "Restarting") } +// ReloadTemplates calls the internal reload-templates function +func ReloadTemplates(ctx context.Context) ResponseExtra { + reqURL := setting.LocalURL + "api/internal/manager/reload-templates" + req := newInternalRequest(ctx, reqURL, "POST") + return requestJSONClientMsg(req, "Reloaded") +} + // FlushOptions represents the options for the flush call type FlushOptions struct { Timeout time.Duration -- cgit v1.2.3