You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-9Lines changed: 23 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,17 @@ This Strapi upload provider adapts the strapi-provider-upload-aws-s3, bundled wi
7
7
Inspired by this discussion: https://github.com/strapi/strapi/issues/5868#issuecomment-705200530
8
8
9
9
This project is essentially the same as https://www.npmjs.com/package/strapi-provider-upload-aws-s3-cdn, but it includes the required dependencies in package.json.
10
+
11
+
## Compatibility
12
+
13
+
- Versions 1.x are compatible with Strapi 3.x
14
+
- Versions 4.x are compatible with Strapi 4.x (bumped this package version to 4.x to make this more obvious)
15
+
10
16
## Configuration
11
17
12
18
Your configuration is passed down to the provider. (e.g: `new AWS.S3(config)`). You can see the complete list of options [here](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property)
13
19
14
-
See the [using a provider](https://strapi.io/documentation/developer-docs/latest/development/plugins/upload.html#using-a-provider) documentation for information on installing and using a provider. And see the [environment variables](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/configurations.html#environment-variables) for setting and using environment variables in your configs.
20
+
See the [using a provider](https://docs.strapi.io/developer-docs/latest/development/providers.html) documentation for information on installing and using a provider. And see the [environment variables](https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/configurations.html#environment-variables) for setting and using environment variables in your configs.
15
21
16
22
If using a CDN to deliver media files to end users, you can include a `cdnUrl` property, as shown below.
17
23
@@ -23,15 +29,17 @@ If using a CDN to deliver media files to end users, you can include a `cdnUrl` p
23
29
module.exports= ({ env }) => ({
24
30
// ...
25
31
upload: {
26
-
provider:'aws-s3-plus-cdn',
27
-
providerOptions: {
28
-
accessKeyId:env('AWS_ACCESS_KEY_ID'),
29
-
secretAccessKey:env('AWS_ACCESS_SECRET'),
30
-
region:env('AWS_REGION'),
31
-
params: {
32
-
Bucket:env('AWS_BUCKET'),
32
+
config: {
33
+
provider:'aws-s3-plus-cdn',
34
+
providerOptions: {
35
+
accessKeyId:env('AWS_ACCESS_KEY_ID'),
36
+
secretAccessKey:env('AWS_ACCESS_SECRET'),
37
+
region:env('AWS_REGION'),
38
+
params: {
39
+
Bucket:env('AWS_BUCKET'),
40
+
},
41
+
cdnUrl:env("CDN_URL"), // Optional CDN URL - include protocol and trailing forward slash, e.g. 'https://assets.example.com/'
33
42
},
34
-
cdnUrl:env("CDN_URL"), // Optional CDN URL - include protofol and trailing forward slash, e.g. 'https://assets.example.com/'
Strapi will use the configured S3 bucket for upload and delete operations, but writes the CDN url (if configured) into the database record.
43
51
44
52
In the event that you need to change the storage backend in the future, to avoid the need to re-upload assets or to write custom queries to update Strapi database records, it is probably best to configure your CDN to use a URL that you control (e.g. use assets.mydomain.com rather than d12345687abc.cloudfront.net). If you need to change the storage backend later, you can simply update your DNS record.
53
+
45
54
## Resources
46
55
47
56
-[License](LICENSE)
57
+
58
+
## Credits
59
+
60
+
- Thanks to @MattieBelt for the Strapi v4 compatibility work
0 commit comments