set default expiry time to 15 minutes

This commit is contained in:
Marc-Roig 2023-03-24 09:35:22 +01:00
parent 7fdc6377a5
commit c4732fe50d
2 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ npm install @strapi/provider-upload-aws-s3 --save
- `providerOptions` is passed down during the construction of the provider. (ex: `new AWS.S3(config)`). [Complete list of options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property) - `providerOptions` is passed down during the construction of the provider. (ex: `new AWS.S3(config)`). [Complete list of options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property)
- `providerOptions.params` is passed directly to the parameters to each method respectively. - `providerOptions.params` is passed directly to the parameters to each method respectively.
- `ACL` is the access control list for the object. Defaults to `public-read`. - `ACL` is the access control list for the object. Defaults to `public-read`.
- `signedUrlExpires` is the number of seconds before a signed URL expires. (See [how signed URLs work](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-urls.html)). Defaults to 7 days and URLs are only signed when ACL is set to `private`. - `signedUrlExpires` is the number of seconds before a signed URL expires. (See [how signed URLs work](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-urls.html)). Defaults to 15 minutes and URLs are only signed when ACL is set to `private`.
- `Bucket` is the name of the bucket to upload to. - `Bucket` is the name of the bucket to upload to.
- `actionOptions` is passed directly to the parameters to each method respectively. You can find the complete list of [upload/ uploadStream options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#upload-property) and [delete options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#deleteObject-property) - `actionOptions` is passed directly to the parameters to each method respectively. You can find the complete list of [upload/ uploadStream options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#upload-property) and [delete options](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#deleteObject-property)
@ -54,7 +54,7 @@ module.exports = ({ env }) => ({
region: env('AWS_REGION'), region: env('AWS_REGION'),
params: { params: {
ACL: env('AWS_ACL', 'public-read'), ACL: env('AWS_ACL', 'public-read'),
signedUrlExpires: env('AWS_SIGNED_URL_EXPIRES', 60 * 60 * 24 * 7), signedUrlExpires: env('AWS_SIGNED_URL_EXPIRES', 15 * 60),
Bucket: env('AWS_BUCKET'), Bucket: env('AWS_BUCKET'),
}, },
}, },

View File

@ -96,7 +96,7 @@ module.exports = {
{ {
Bucket: config.params.Bucket, Bucket: config.params.Bucket,
Key: fileKey, Key: fileKey,
Expires: getOr(60 * 60 * 24 * 7, ['params', 'signedUrlExpires'], config), // 7 days Expires: getOr(15 * 60, ['params', 'signedUrlExpires'], config), // 15 minutes
}, },
(err, url) => { (err, url) => {
if (err) { if (err) {