-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add option to generate pre-signed URL with expiration time #180
feat: Add option to generate pre-signed URL with expiration time #180
Conversation
Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
…peration in the getSignedUrl function Signed-off-by: Daniel San <[email protected]>
Signed-off-by: Daniel San <[email protected]>
can't wait for it ! 😱 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #180 +/- ##
==========================================
- Coverage 95.72% 95.56% -0.16%
==========================================
Files 2 2
Lines 187 203 +16
Branches 41 43 +2
==========================================
+ Hits 179 194 +15
- Misses 8 9 +1
☔ View full report in Codecov by Sentry. |
Thanks for opening this pull request!
|
lib/optionsFromArguments.js
Outdated
@@ -93,6 +95,8 @@ const optionsFromArguments = function optionsFromArguments(args) { | |||
options = fromEnvironmentOrDefault(options, 'baseUrlDirect', 'S3_BASE_URL_DIRECT', false); | |||
options = fromEnvironmentOrDefault(options, 'signatureVersion', 'S3_SIGNATURE_VERSION', 'v4'); | |||
options = fromEnvironmentOrDefault(options, 'globalCacheControl', 'S3_GLOBAL_CACHE_CONTROL', null); | |||
options = fromEnvironmentOrDefault(options, 'presignedUrl', 'S3_PRESIGNED_URL', false); | |||
options = fromEnvironmentOrDefault(options, 'presignedUrlExpires', 'S3_PRESIGNED_URL_EXPIRES', 900); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you get to 900? Is this a random value you chose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the previous PR owner figured 15 mins was a good default value, should this be changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the AWS API use a default value if none is supplied?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#getSignedUrl-property
Oh it does look like s3's getSignedURL
defaults Expires
to 900 seconds
Options Hash (params):
Expires (Integer) — default: 900 — the number of seconds to expire the pre-signed URL operation in. Defaults to 15 minutes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we don't have to set a default value, as the S3 SDK will set that, right? If so, I'd suggest to only send a value to the S3 SDK if the Parse Server option is set, otherwise not send anything and let the default value of the SDK apply. You could add a line to the Parse Server option table in the README that if no value is set, the AWS S3 SDK default value applies.
Wouldl love this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, let's wait for the CI to pass and I think we can merge this.
# [2.1.0](2.0.2...2.1.0) (2023-05-12) ### Features * Add option to generate pre-signed URL with expiration time ([#180](#180)) ([d92363d](d92363d))
🎉 This change has been released in version 2.1.0 |
Nice work @danielsanfr and @andrewalc! |
Addresses:
PR branched off of:
Updated test with refactoring request that was mentioned here: https://github.com/parse-community/parse-server-s3-adapter/pull/117/files#r676915013