Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
* keyStart: 'editor/',
* acl: 'public-read',
* accessKey: 'YOUR-AMAZON-S3-PUBLIC-ACCESS-KEY',
* secretKey: 'YOUR-AMAZON-S3-SECRET-ACCESS-KEY'
* secretKey: 'YOUR-AMAZON-S3-SECRET-ACCESS-KEY',
* policyExpiration: (new Date).getTime() + (60 * 60 * 1000)
* }
*
* @return:
Expand Down Expand Up @@ -52,8 +53,11 @@ function getHash(config) {
var xAmzDate = dateString + 'T000000Z';

var policy = {
// 5 minutes into the future
expiration: new Date((new Date).getTime() + (5 * 60 * 1000)).toISOString(),
// Date or timestamp from config OR 5 minutes into the future
expiration: new Date(
config.policyExpiration
|| (new Date).getTime() + (5 * 60 * 1000)
).toISOString(),
conditions: [
{bucket: bucket},
{acl: acl },
Expand Down