Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function deployProject(account, project, options, cb) {
var opts = buildApigeetoolOpts(account, {
api: project.api.name,
main: project.api.main,
directory: project.dirname,
'base-path': project.api.basePath,
'import-only': !!options.importOnly,
'resolve-modules': !options.upload,
virtualhosts: account.virtualhosts,
environments: account.environment
});
delete(opts.environment);
apigeetool.deployNodeApp(opts, function(err, results) {
if (err) {
if (err.code === 'ECONNRESET' && err.message === 'socket hang up') {
err.message = 'Deployment timeout. Please try again or use the --upload option.'
}
return cb(err);
}
emit('');
emit({ Deployed: results });
if (!results) { return cb(); } // todo: temp fix to avoid error in existing tests, remove when tests have been updated
async.each(results, function(result, cb) {
addResources(account, project, result, cb);
}, cb);
});