From f36a17d41876bce912aad3ec7722024c1fca41d9 Mon Sep 17 00:00:00 2001 From: ehsan shariati Date: Wed, 26 Jul 2023 00:46:01 -0400 Subject: [PATCH] set ota_version in env --- wap/pkg/config/config.go | 2 ++ wap/pkg/server/server.go | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/wap/pkg/config/config.go b/wap/pkg/config/config.go index f756ab04..18912fd0 100644 --- a/wap/pkg/config/config.go +++ b/wap/pkg/config/config.go @@ -23,6 +23,7 @@ var ( FORCE_ACCESSPOINT string COUNTRY string BLOX_COMMAND string + OTA_VERSION string ) func getEnv(key, fallback string) string { @@ -58,4 +59,5 @@ func init() { COUNTRY = getEnv("COUNTRY", "GB") PROJECT_ROOT = getEnv("PROJECT_ROOT", "../..") BLOX_COMMAND = getEnv("BLOX_COMMAND", "/app --authorizer %s --identity %s --initOnly --config /internal/config.yaml --storeDir /uniondrive") + OTA_VERSION = getEnv("OTA_VERSION", "3") } diff --git a/wap/pkg/server/server.go b/wap/pkg/server/server.go index 8f9d4299..23faa9a8 100644 --- a/wap/pkg/server/server.go +++ b/wap/pkg/server/server.go @@ -7,6 +7,7 @@ import ( "io" "net" "net/http" + "strconv" "time" "github.com/functionland/go-fula/blockchain" @@ -87,8 +88,11 @@ func propertiesHandler(w http.ResponseWriter, r *http.Request) { response["containerInfo_fula"] = fulaContainerInfo response["containerInfo_fxsupport"] = fxsupportContainerInfo response["containerInfo_node"] = nodeContainerInfo - response["ota_version"] = 3 - response["ota_type"] = "rk" + ota_ver, err := strconv.Atoi(config.OTA_VERSION) + if err != nil { + ota_ver = 3 + } + response["ota_version"] = ota_ver w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK)