summaryrefslogtreecommitdiff
path: root/cmd/gotosocial/server.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-01-29 16:57:04 +0100
committerLibravatar GitHub <noreply@github.com>2025-01-29 16:57:04 +0100
commitd16e4fa34df222e08968b060d40aaf6b6ebeb912 (patch)
tree76fa8e3d1e1b6b47e9a0c34fe523e53edec8d2b7 /cmd/gotosocial/server.go
parent[chore] remove type switch in Create() and instead move to FederatedCallbacks... (diff)
downloadgotosocial-d16e4fa34df222e08968b060d40aaf6b6ebeb912.tar.xz
[feature] Use maintenance router to serve 503 while server is starting/migrating (#3705)
* [feature] Use maintenance router to serve 503 while server is starting/migrating * love you linter, kissies
Diffstat (limited to 'cmd/gotosocial/server.go')
-rw-r--r--cmd/gotosocial/server.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/gotosocial/server.go b/cmd/gotosocial/server.go
index 80efc7486..da571ec3f 100644
--- a/cmd/gotosocial/server.go
+++ b/cmd/gotosocial/server.go
@@ -41,5 +41,19 @@ func serverCommands() *cobra.Command {
}
config.AddServerFlags(serverStartCmd)
serverCmd.AddCommand(serverStartCmd)
+
+ serverMaintenanceCmd := &cobra.Command{
+ Use: "maintenance",
+ Short: "start the gotosocial server in maintenance mode (returns 503 for almost all requests)",
+ PreRunE: func(cmd *cobra.Command, args []string) error {
+ return preRun(preRunArgs{cmd: cmd})
+ },
+ RunE: func(cmd *cobra.Command, args []string) error {
+ return run(cmd.Context(), server.Maintenance)
+ },
+ }
+ config.AddServerFlags(serverMaintenanceCmd)
+ serverCmd.AddCommand(serverMaintenanceCmd)
+
return serverCmd
}