From 137b23da10719ea2939f829bb1a99b64f3ad9f6e Mon Sep 17 00:00:00 2001 From: Alex X Date: Sat, 26 Aug 2023 07:13:59 +0300 Subject: [PATCH] Fix config file validating --- internal/api/config.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/api/config.go b/internal/api/config.go index a5548b05..9072e8d3 100644 --- a/internal/api/config.go +++ b/internal/api/config.go @@ -1,11 +1,12 @@ package api import ( - "github.com/AlexxIT/go2rtc/internal/app" - "gopkg.in/yaml.v3" "io" "net/http" "os" + + "github.com/AlexxIT/go2rtc/internal/app" + "gopkg.in/yaml.v3" ) func configHandler(w http.ResponseWriter, r *http.Request) { @@ -40,8 +41,7 @@ func configHandler(w http.ResponseWriter, r *http.Request) { } } else { // validate config - var tmp struct{} - if err = yaml.Unmarshal(data, &tmp); err != nil { + if err = yaml.Unmarshal(data, map[string]any{}); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return }