From efc7072c6388323778dd8e73e0673432387ef371 Mon Sep 17 00:00:00 2001 From: Iru Sensei Date: Sun, 23 Nov 2025 19:55:50 +0100 Subject: [PATCH] .. --- main.go | 2 +- server.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 67809f1..6bc7d1a 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ import ( func main() { cfg := LoadConfig() - http.HandleFunc("/", alertReceiver) + http.HandleFunc("/", cfg.alertReceiver) log.Printf("Server starting on http://localhost:%d", cfg.Port) log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", cfg.Port), nil)) } diff --git a/server.go b/server.go index 64cab5d..4fb81a4 100644 --- a/server.go +++ b/server.go @@ -5,8 +5,8 @@ import ( "net/http" ) -func alertReceiver(w http.ResponseWriter, r *http.Request) { - cfg := LoadConfig() + +func (cfg *Config) alertReceiver(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPost { http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) return