Skip to content

Commit

Permalink
add notrequired check
Browse files Browse the repository at this point in the history
  • Loading branch information
playground committed Nov 23, 2021
1 parent 5ac6280 commit b32e7d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup/config/env-hzn.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"MMS_SERVICE_VERSION": "1.0.0",
"MMS_OBJECT_TYPE": "object_detection",
"MMS_OBJECT_ID": "config.json",
"MMS_OBJECT_FILE": "path-to-file"
"MMS_OBJECT_FILE": ""
},
"metaVars": {
}
Expand Down
4 changes: 2 additions & 2 deletions src/common/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import jsonfile from 'jsonfile';


const env = process.env.npm_config_env || 'biz';
const notRequired = ['SERVICE_CONTAINER_CREDS', 'MMS_CONTAINER_CREDS', 'MMS_OBJECT_FILE', 'HZN_CUSTOM_NODE_ID', 'UPDATE_FILE_NAME'];

export class Utils {
hznConfig = '/etc/default/config';
Expand Down Expand Up @@ -155,7 +156,6 @@ export class Utils {
let hznJson = jsonfile.readFileSync(`${this.hznConfig}/.env-hzn.json`);
let envVars = hznJson[org]['envVars'];
let i = 0;
const notRequired = ['SERVICE_CONTAINER_CREDS', 'MMS_CONTAINER_CREDS', 'MMS_OBJECT_FILE'];
for(const [key, value] of Object.entries(envVars)) {
props[i] = {name: key, default: value, required: notRequired.indexOf(key) < 0};
i++;
Expand Down Expand Up @@ -221,7 +221,7 @@ export class Utils {
if(prop[0] === 'HZN_CUSTOM_NODE_ID' && (!prop[1] || prop[1].length == 0)) {
prop[1] = os.hostname();
}
props[i] = {name: prop[0], default: prop[1], required: true};
props[i] = {name: prop[0], default: prop[1], required: notRequired.indexOf(prop[0]) < 0};
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/env-hzn.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"MMS_SERVICE_VERSION": "1.0.0",
"MMS_OBJECT_TYPE": "object_detection",
"MMS_OBJECT_ID": "config.json",
"MMS_OBJECT_FILE": "path-to-file"
"MMS_OBJECT_FILE": ""
},
"metaVars": {
}
Expand Down

0 comments on commit b32e7d1

Please sign in to comment.