-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Storage): S3 bucket instead of EC2 storage for images and thumbn…
…ails (#17) * feat(s3): default plugin config + no credentials patch --------- Co-authored-by: Nathan Agez <nathan.agez@gmail.com>
- Loading branch information
1 parent
6c4efbe
commit 810581e
Showing
5 changed files
with
1,183 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,45 @@ | ||
export default [ | ||
'strapi::errors', | ||
{ | ||
name: "strapi::security", | ||
config: { | ||
contentSecurityPolicy: { | ||
useDefaults: true, | ||
directives: { | ||
"connect-src": ["'self'", "https:"], | ||
"img-src": ["'self'", "data:", "blob:", "*"], | ||
"media-src": ["'self'", "data:", "blob:", "*"], | ||
"default-src":["'self'"], | ||
"script-src": ["'self'", "'unsafe-inline'"], | ||
upgradeInsecureRequests: null, | ||
export default ({ env }) => ( | ||
[ | ||
'strapi::errors', | ||
{ | ||
name: 'strapi::security', | ||
config: { | ||
contentSecurityPolicy: { | ||
useDefaults: true, | ||
directives: { | ||
'connect-src': ["'self'", 'https:'], | ||
'img-src': [ | ||
"'self'", | ||
'data:', | ||
'blob:', | ||
'market-assets.strapi.io', | ||
env('AWS_BUCKET_ENDPOINT'), | ||
|
||
], | ||
'media-src': [ | ||
"'self'", | ||
'data:', | ||
'blob:', | ||
'market-assets.strapi.io', | ||
env('AWS_BUCKET_ENDPOINT'), | ||
], | ||
upgradeInsecureRequests: null, | ||
}, | ||
}, | ||
}, | ||
}, | ||
'strapi::cors', | ||
'strapi::poweredBy', | ||
'strapi::logger', | ||
'strapi::query', | ||
'strapi::body', | ||
'strapi::session', | ||
{ | ||
name: 'strapi::favicon', | ||
config: { | ||
path: './src/admin/extensions/trackit.png' | ||
}, | ||
}, | ||
}, | ||
'strapi::cors', | ||
'strapi::poweredBy', | ||
'strapi::logger', | ||
'strapi::query', | ||
'strapi::body', | ||
'strapi::session', | ||
{ | ||
name: 'strapi::favicon', | ||
config: { | ||
path: './src/admin/extensions/trackit.png' | ||
}, | ||
}, | ||
'strapi::public', | ||
]; | ||
'strapi::public', | ||
] | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,36 @@ | ||
export default { | ||
// ... | ||
'cloudfront-metrics': { | ||
enabled: true, | ||
resolve: './src/plugins/cloudfront-metrics' | ||
}, | ||
'custom-selects': { | ||
enabled: true, | ||
resolve: './src/plugins/custom-selects' | ||
}, | ||
'docusaurus': { | ||
enabled: true, | ||
resolve: './src/plugins/docusaurus' | ||
}, | ||
// ... | ||
} | ||
export default async ({ env }) => { | ||
|
||
return { | ||
upload: { | ||
config: { | ||
provider: 'aws-s3', | ||
providerOptions: { | ||
s3Options: { | ||
region: env('AWS_REGION'), | ||
params: { | ||
ACL: 'private', // <== set ACL to private | ||
Bucket: env('AWS_BUCKET'), | ||
}, | ||
}, | ||
}, | ||
actionOptions: { | ||
upload: {}, | ||
uploadStream: {}, | ||
delete: {}, | ||
}, | ||
}, | ||
}, | ||
'cloudfront-metrics': { | ||
enabled: true, | ||
resolve: './src/plugins/cloudfront-metrics' | ||
}, | ||
'custom-selects': { | ||
enabled: true, | ||
resolve: './src/plugins/custom-selects' | ||
}, | ||
'docusaurus': { | ||
enabled: true, | ||
resolve: './src/plugins/docusaurus' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/node_modules/@strapi/provider-upload-aws-s3/dist/index.js b/node_modules/@strapi/provider-upload-aws-s3/dist/index.js | ||
index 6cec5cd..817ce80 100644 | ||
--- a/node_modules/@strapi/provider-upload-aws-s3/dist/index.js | ||
+++ b/node_modules/@strapi/provider-upload-aws-s3/dist/index.js | ||
@@ -69,7 +69,7 @@ const extractCredentials = (options) => { | ||
secretAccessKey: options.s3Options.credentials.secretAccessKey | ||
}; | ||
} | ||
- throw new Error("Couldn't find AWS credentials."); | ||
+ return undefined; | ||
}; | ||
const assertUrlProtocol = (url) => { | ||
return /^\w*:\/\//.test(url); |
Oops, something went wrong.