@hclsoftware/secagent
Version:
IAST agent
35 lines (29 loc) • 1.05 kB
JavaScript
// util script to inject host and token values into agent-config.json
// usage:
// UpdateAgentConfig.js <IAST_HOST> <IAST_ACCESS_TOKEN>
/*
* ****************************************************
* Licensed Materials - Property of HCL.
* (c) Copyright HCL Technologies Ltd. 2017, 2025.
* Note to U.S. Government Users *Restricted Rights.
* ****************************************************
*/
const fs = require('fs');
//const config = require('./agent-config.json')
let config = {}
if (process.argv.length < 4) {
console.error("missing input arguments. got: " + process.argv)
console.error("Usage: UpdateAgentConfig.js <IAST_HOST> <IAST_ACCESS_TOKEN>")
}
else {
config['host'] = process.argv[2]
config['accessToken'] = process.argv[3]
const target = 'agent-config.json.tmp'
try {
fs.writeFileSync(target, JSON.stringify(config, null, 4))
console.log("JSON data is saved to " + target);
} catch (error) {
console.error(error);
}
}