Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (options.baseuri && options.organization &&
options.username && options.password &&
options.environments && options.virtualhosts) {
var deploymentOptions = {}
deploymentOptions.directory = destination + '/' + apiProxy
deploymentOptions.api = apiProxy
deploymentOptions.baseuri = options.baseuri
deploymentOptions.organization = options.organization
deploymentOptions.username = options.username
deploymentOptions.password = options.password
deploymentOptions.environments = options.environments
deploymentOptions.virtualhosts = options.virtualhosts
// deploymentOptions.verbose = true;
// deploymentOptions.debug = true;
// deploymentOptions['import-only'] = true;
apigeetool.deployProxy(deploymentOptions, function (err) {
if (err) {
return cb(err, {})
}
return cb(null, {})
})
} else {
inquirer.prompt(questions).then(function (answers) {
answers.directory = destination + '/' + apiProxy
answers.api = apiProxy
apigeetool.deployProxy(answers, function (err) {
if (err) {
return cb(err, {})
}
return cb(null, {})
})
})
virtualhosts: options.virtualHosts || DEFAULT_HOSTS
};
if (options.token) {
opts.token = options.token;
} else {
opts.username = options.username;
opts.password = options.password;
}
editVirtualHosts(dir + "/apiproxy/proxies/default.xml", opts.virtualhosts);
//set the edgemicro-internal endpoint in edgemicro-auth
if (options.runtimeUrl) {
setEdgeMicroInternalEndpoint(dir + "/apiproxy/policies/Authenticate-Call.xml", options.runtimeUrl);
}
writeConsoleLog('log',{component: CONSOLE_LOG_TAG_COMP},'Give me a minute or two... this can take a while...');
apigeetool.deployProxy(opts, function(err) {
if (err) {
if (err.code === 'ECONNRESET' && err.message === 'socket hang up') {
err.message = 'Deployment timeout. Please try again or use the --upload option.'
} else if (err.message === 'Get API info returned status 401') {
err.message = 'Invalid credentials or not sufficient permission. Please correct and try again.'
}
return callback(err);
} else {
writeConsoleLog('log',{component: CONSOLE_LOG_TAG_COMP},'App %s deployed.', options.proxyName);
callback(null, options.runtimeUrl ? authUri + '/publicKey' : util.format(authUri + '/publicKey', options.org, options.env));
}
//writeConsoleLog('log',{component: CONSOLE_LOG_TAG_COMP},'App %s added to your org. Now adding resources.', options.proxyName);
/* opts.password = options.password; // override a apigeetool side-effect bug
installJavaCallout(managementUri, opts, function(err) {
verbose: options.debug,
api: 'edgemicro-internal',
directory: path.join(__dirname, '..', '..', 'edge'),
'import-only': false,
'resolve-modules': false,
virtualhosts: this.virtualHosts || 'default'
};
if (options.token) {
opts.token = options.token;
} else {
opts.username = options.username;
opts.password = options.password;
}
apigeetool.deployProxy(opts, function(err, res) {
if (err) {
return callback(err);
}
callback(null, res);
});
}
inquirer.prompt(questions).then(function (answers) {
answers.directory = destination + '/' + apiProxy
answers.api = apiProxy
apigeetool.deployProxy(answers, function (err) {
if (err) {
return cb(err, {})
}
return cb(null, {})
})
})
}