From: Banana Date: Thu, 25 Jul 2024 20:11:20 +0000 (+0200) Subject: added config change to validation X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=b5826cc1120822ab2abbffd8bd3d5a1349721228;p=scientia.git added config change to validation config change in add call Signed-off-by: Banana --- diff --git a/client/go-cli/scientia/cmd/add.go b/client/go-cli/scientia/cmd/add.go index 139cee3..4529a8e 100644 --- a/client/go-cli/scientia/cmd/add.go +++ b/client/go-cli/scientia/cmd/add.go @@ -97,7 +97,7 @@ func upload(payload string) Response { jsonData, err := json.Marshal(payloadStruct) Helper.ErrorCheck(err, "Can not create json payload") - req, err := http.NewRequest(http.MethodPost, ScientiaConfig.Endpoint.Url, bytes.NewBuffer(jsonData)) + req, err := http.NewRequest(http.MethodPost, ScientiaConfig.Endpoint.Add, bytes.NewBuffer(jsonData)) Helper.ErrorCheck(err, "Can not create http request") // We need to set the content type from the writer, it includes necessary boundary as well req.Header.Set("Content-Type", "application/json; charset=UTF-8") diff --git a/client/go-cli/scientia/cmd/root.go b/client/go-cli/scientia/cmd/root.go index 37d3bcb..93b37ab 100644 --- a/client/go-cli/scientia/cmd/root.go +++ b/client/go-cli/scientia/cmd/root.go @@ -83,8 +83,8 @@ func loadConfig() { err = decoder.Decode(&ScientiaConfig) Helper.ErrorCheck(err, "Can not decode config file") - if ScientiaConfig.Endpoint.Add == "" || ScientiaConfig.Endpoint.Secret == "" { - log.Fatal("Empty config?") + if ScientiaConfig.Endpoint.Add == "" || ScientiaConfig.Endpoint.Get == "" || ScientiaConfig.Endpoint.Secret == "" { + log.Fatal("Empty or outdated config?") } if FlagDebug {