Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// to run locally against your papi json, run 'npm run configure'
// and set env var AKA_PAPI_JSON_FILE to your json, eg. 'papiJson/your.property-v1.papi.json'
// lua output file
let localPapiJson = process.env.AKA_PAPI_JSON_FILE ? process.env.AKA_PAPI_JSON_FILE : 'sample.papi.json';
setLocalConfig(
localPapiJson,
luaOutputFile
);
} else {
// edgerc section name
let edgercSection = process.env.AKA_EDGERC_SECTION ? process.env.AKA_EDGERC_SECTION : 'default';
// assumes you have configured edgegrid
const edgegrid = new EdgeGrid({
path: process.env.AKA_EDGERC,
section: edgercSection
});
// assumes you have set env vars as output of 'npm run configure' or another method
setApiConfig(
edgegrid,
process.env.AKA_CONTRACT_ID,
process.env.AKA_GROUP_ID,
process.env.AKA_PROPERTY_ID,
process.env.AKA_PROPERTY_VERSION,
luaOutputFile
);
}
// map old to new values in generated lua based on local json (gitignored)
(async function() {
// load .env vars
dotenv.config();
let papiResponses = new Map();
const edgegrid = new EdgeGrid({
path: process.env.AKA_EDGERC,
section: 'default'
});
let contractId = await papiChoice(
'Select Akamai contract:',
'/papi/v1/contracts',
'contracts', 'contractId', 'contractTypeName'
);
let groupId = await papiChoice(
'Select Akamai property group:',
'/papi/v1/groups/?contractId=' + contractId,
'groups', 'groupId', 'groupName'
);