From e611063669e1bd3e5085957894a95b2d55fc3cf7 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Mon, 20 Jun 2022 12:29:59 +0200 Subject: [PATCH] Migrate platform config out of Gin --- platform_config.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platform_config.go b/platform_config.go index 8407feaa..e38996f2 100644 --- a/platform_config.go +++ b/platform_config.go @@ -7,6 +7,7 @@ import ( textTemplate "text/template" "github.com/gofrs/uuid" + "github.com/gorilla/mux" "github.com/rs/zerolog/log" ) @@ -188,7 +189,16 @@ func (h *Headscale) ApplePlatformConfig( w http.ResponseWriter, r *http.Request, ) { - platform := r.URL.Query().Get("platform") + vars := mux.Vars(r) + platform, ok := vars["platform"] + if !ok { + log.Error(). + Str("handler", "ApplePlatformConfig"). + Msg("No platform specified") + http.Error(w, "No platform specified", http.StatusBadRequest) + + return + } id, err := uuid.NewV4() if err != nil {