How to use the apigeetool.deployNodeApp function in apigeetool

To help you get started, we’ve selected a few apigeetool examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apigee-127 / a127 / lib / commands / account / providers / apigee.js View on Github external
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);
  });