From cd98b2ac40d0ca461c79cf87e8cb737118148334 Mon Sep 17 00:00:00 2001 From: Michael Holt Date: Tue, 6 Jun 2017 09:34:48 -0700 Subject: [PATCH] Enabled optional ACL setting. - Applies to all files uploaded. - set in config file. - updated readme.md with list of possible values. --- app.js | 3 ++- readme.md | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index d10ccc4..6fbfb74 100644 --- a/app.js +++ b/app.js @@ -92,7 +92,8 @@ function upload(opts) { Key: opts.key, /* required */ Body: opts.body, CacheControl: config.cache, - ContentType: opts.contentType + ContentType: opts.contentType, + ACL: config.acl }; if (opts.encoding) { diff --git a/readme.md b/readme.md index a2b0879..5185326 100644 --- a/readme.md +++ b/readme.md @@ -15,7 +15,8 @@ Set configuration as a json file: "bucket": "my.s3.bucket.name", "directory": "/path/to/my/website/_site", "compress": "html|css|js|json", - "cache": "max-age=60" + "cache": "max-age=60", + "acl": "private" } ``` @@ -23,6 +24,7 @@ Set configuration as a json file: - `directory` local directory to sync with bucket - `compress` regex match for files to apply gzip compression - `cache` `Cache-control` header value +- `acl` A canned ACL to apply to all objects (see below) Uses the AWS Javascript SDK, so it reads your AWS credentials from environment variables or a local file. [See more here](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html#Setting_AWS_Credentials). @@ -34,3 +36,15 @@ Run with the config file path (e.g. `~/path-to/config.json`) as an argument. $ npm install $ node app.js [config file] ``` + +## ACL Values + +The default ACL value is "bucket-owner-full-control" and will be used if no setting is provided. Possible values include: + +* "private" +* "public-read" +* "public-read-write" +* "authenticated-read" +* "aws-exec-read" +* "bucket-owner-read" +* "bucket-owner-full-control"