lib/configure.js
function configurePolicyForBucket(aws, bucketName, customPolicy) {
  const policy = customPolicy || {
    Version: '2012-10-17',
    Statement: [
      {
        Effect: 'Allow',
        Principal: {
          AWS: '*'
        },
        Action: 's3:GetObject',
        Resource: `arn:aws:s3:::${bucketName}/*`
      }
    ]
  };

  const params = {
    Bucket: bucketName,
    Policy: JSON.stringify(policy)
  };

  return aws.request('S3', 'putBucketPolicy', params);
}
function configurePolicyForBucket(aws, bucketName, customPolicy) {
  const policy = customPolicy || {
    Version: '2012-10-17',
    Statement: [
      {
        Effect: 'Allow',
        Principal: {
          AWS: '*'
        },
        Action: 's3:GetObject',
        Resource: `arn:aws:s3:::${bucketName}/*`
      }
    ]
  };

  const params = {
    Bucket: bucketName,
    Policy: JSON.stringify(policy)
  };

  return aws.request('S3', 'putBucketPolicy', params);
}
function configurePolicyForBucket ( aws , bucketName , customPolicy ) { const policy = customPolicy || { Version : '2012-10-17' , Statement : [ { Effect : 'Allow' , Principal : { AWS : '*' } , Action : 's3:GetObject' , Resource : ` ${ bucketName } ` } ] } ; const params = { Bucket : bucketName , Policy : JSON . stringify ( policy ) } ; return aws . request ( 'S3' , 'putBucketPolicy' , params ) ; }
Configures policy for given bucket
@param {Object} aws - AWS class
@param {string} bucketName - Name of bucket to be configured
Configures policy for given bucket