nhost / hasura-backend-plus

🔑Auth and 📦Storage for Hasura. The quickest way to get Auth and Storage working for your next app based on Hasura.
https://nhost.github.io/hasura-backend-plus/
MIT License
1.17k stars 187 forks source link

Presigned urls #473

Closed aaronhayes closed 3 years ago

aaronhayes commented 3 years ago

Adds support for uploading/fetching files via presigned urls.

This adds two new routes full storage rules are applied to these routes. POST storage/presign/... GET storage/presign/... Each endpoint returns a json object

{
  key: fileKey,
  url: presignedUrl
}

URL expiry defaults to a new env variable S3_PRESIGNED_URL_EXPIRES_DEFAULT this has a default value of 24 hours. However, the expiry of the url can be modified in each request by passing the expires parameter. e.g. GET storage/presign/users/${userID}avatars/headshot.jpg?expires=100 would expire in 100 seconds.

Fixes #472

elitan commented 3 years ago

I'll close this as we'll not support pre-signed URLs with Hasura Backend Plus.

We hope to share something very much related in the future under a different repo. Stay tuned 😎.