From c0dc6c954c5cf6b2ad6d79fe4969fa54669624cf Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Thu, 6 Jul 2023 15:36:32 -0400 Subject: [PATCH] fixed HZN_MGMT_HUB_CERT_PATH --- package.json | 2 +- src/common/src/utils.ts | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a167302..6187c75 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hzn-cli", - "version": "0.6.0", + "version": "0.6.2", "description": "Open Horizon CLI toolkit helps streamline the process of preparing node agents and perform tasks between orgs environments", "main": "./build/index.js", "bin": { diff --git a/src/common/src/utils.ts b/src/common/src/utils.ts index 3f7e80d..f651eb1 100644 --- a/src/common/src/utils.ts +++ b/src/common/src/utils.ts @@ -143,16 +143,21 @@ export class Utils { console.log(key) if(content.length > 0) content += '\n' if(pEnv[key]) { - content += `${key}=${pEnv[key]}` + if(key == 'HZN_MGMT_HUB_CERT_PATH') { + const cert = /[^\/]+$/.exec(pEnv.CONFIG_CERT_PATH) + if(cert) { + content += `/var/${key}=${cert[0]}` + } + } else { + content += `${key}=${pEnv[key]}` + } } else { if(HorizonKeyMap[key]) { pEnv[key] = HorizonTemplate[key] content += `${key}=${pEnv[key]}` - } - if(key == 'HZN_NODE_ID') { + } else if(key == 'HZN_NODE_ID') { content += `${key}=${pEnv.HZN_DEVICE_ID}` - } - if(key == 'HZN_MGMT_HUB_CERT_PATH') { + } else if(key == 'HZN_MGMT_HUB_CERT_PATH') { const cert = /[^\/]+$/.exec(pEnv.CONFIG_CERT_PATH) if(cert) { content += `/var/${key}=${cert[0]}`