Procházet zdrojové kódy

added config change to validation
config change in add call

Signed-off-by: Banana <mail@bananas-playground.net>

Banana před 1 měsícem
rodič
revize
b5826cc112

+ 1 - 1
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")

+ 2 - 2
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 {