How to use the @mapbox/cloudfriend.build function in @mapbox/cloudfriend

To help you get started, we’ve selected a few @mapbox/cloudfriend 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 mapbox / stork / bin / bootstrap.js View on Github external
const deployStack = (region, bucket) => {
  const opts = { cwd: path.resolve(__dirname, '..' ) };
  const cfn = new AWS.CloudFormation({ region });

  const privateKey = fs.readFileSync(cli.flags.appKeyfile, 'utf8');

  const preamble = [
    exec('git rev-parse HEAD', opts),
    cf.build(path.resolve(__dirname, '..', 'cloudformation', 'stork.template.js'))
  ];

  if (cli.flags.kms) {
    const kms = new AWS.KMS({ region });
    preamble.push(encrypt(kms, cli.flags.npmToken));
    preamble.push(encrypt(kms, privateKey));
    preamble.push(encrypt(kms, cli.flags.githubToken));
  }

  return Promise.all(preamble).then((results) => {
    const gitsha = results[0];
    const template = results[1];
    const encryptedNpm = results[2];
    const encryptedGithub = results[3];
    const encryptedGithubToken = results[4];
    const params = {