From b5826cc1120822ab2abbffd8bd3d5a1349721228 Mon Sep 17 00:00:00 2001 From: Banana Date: Thu, 25 Jul 2024 22:11:20 +0200 Subject: [PATCH] added config change to validation config change in add call Signed-off-by: Banana --- client/go-cli/scientia/cmd/add.go | 2 +- client/go-cli/scientia/cmd/root.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 { -- 2.39.5