1// Copyright 2020 The Gitea Authors. All rights reserved.
2// Use of this source code is governed by a MIT-style
3// license that can be found in the LICENSE file.
4
5//go:build windows
6// +build windows
7
8package private
9
10import (
11	"net/http"
12
13	"code.gitea.io/gitea/modules/context"
14	"code.gitea.io/gitea/modules/graceful"
15	"code.gitea.io/gitea/modules/private"
16)
17
18// Restart is not implemented for Windows based servers as they can't fork
19func Restart(ctx *context.PrivateContext) {
20	ctx.JSON(http.StatusNotImplemented, private.Response{
21		Err: "windows servers cannot be gracefully restarted - shutdown and restart manually",
22	})
23}
24
25// Shutdown causes the server to perform a graceful shutdown
26func Shutdown(ctx *context.PrivateContext) {
27	graceful.GetManager().DoGracefulShutdown()
28	ctx.PlainText(http.StatusOK, "success")
29}
30