From f410ad4643ddb6bdfacd89bd78fcd610ef63943f Mon Sep 17 00:00:00 2001
From: Gregor Best <gbe@unobtanium.de>
Date: Sun, 11 Apr 2021 19:41:53 +0200
Subject: [PATCH] Remove server killing debug handler

---
 main.go             | 12 ------------
 templates/index.tpl |  4 ----
 2 files changed, 16 deletions(-)

diff --git a/main.go b/main.go
index 4a0bbd1..9352de0 100644
--- a/main.go
+++ b/main.go
@@ -6,7 +6,6 @@ import (
 	"html/template"
 	"log"
 	"net/http"
-	"os"
 	"strconv"
 
 	"github.com/jmoiron/sqlx"
@@ -34,17 +33,6 @@ func main() {
 
 	http.Handle("/static/", http.FileServer(http.FS(staticFS)))
 
-	http.HandleFunc("/debug/quit", func(w http.ResponseWriter, r *http.Request) {
-		if r.Method != "POST" {
-			http.Error(w, "invalid method:"+r.Method, http.StatusMethodNotAllowed)
-			return
-		}
-
-		log.Println("exit requested by", r.RemoteAddr)
-
-		os.Exit(0)
-	})
-
 	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
 		log.Println("handling", r.Method, r.URL, "from", r.RemoteAddr)
 
diff --git a/templates/index.tpl b/templates/index.tpl
index 187238e..e46b4bf 100644
--- a/templates/index.tpl
+++ b/templates/index.tpl
@@ -23,9 +23,5 @@
 	</table>
 
 	<p>And a bit of foo.</p>
-	<hr/>
-	<form method="POST" action="/debug/quit">
-		<button type="submit">Kill server</button>
-	</form>
 </body>
 </html>
\ No newline at end of file
-- 
GitLab