Skip to content

Commit

Permalink
Merge pull request #161 from mitre/dev
Browse files Browse the repository at this point in the history
Cloudinary To AWS
  • Loading branch information
ChrisHinchey authored Sep 1, 2023
2 parents d1b9bdf + 4014f09 commit 0c35428
Show file tree
Hide file tree
Showing 5 changed files with 391 additions and 676 deletions.
14 changes: 9 additions & 5 deletions .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ DATABASE_USERNAME=CHANGEME
DATABASE_PASSWORD=CHANGEME
DATABASE_NAME=CHANGEME

# ---------- Cloudinary ---------- #
# ---------- AWS ---------- #
# Variables below aren't needed for local development unless using Cloudinary
CLOUDINARY_NAME=CHANGEME
CLOUDINARY_KEY=CHANGEME
CLOUDINARY_SECRET=CHANGEME

CDN_URL=CHANGEME
CDN_ROOT_PATH=CHANGEME
AWS_ACCESS_KEY_ID=CHANGEME
AWS_ACCESS_SECRET=CHANGEME
AWS_REGION=CHANGEME
AWS_ACL=CHANGEME
AWS_SIGNED_URL_EXPIRES=CHANGEME
AWS_BUCKET=CHANGEME

# Strapi will add additional environment variables below (e.g., JWT_SECRET)
42 changes: 28 additions & 14 deletions config/middlewares.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
// ~/strapi-aws-s3/backend/config/middlewares.js

module.exports = [
"strapi::errors",
"strapi::cors",
"strapi::poweredBy",
"strapi::logger",
"strapi::query",
"strapi::body",
"strapi::session",
"strapi::favicon",
"strapi::public",
'strapi::errors',
{
name: "strapi::security",
name: 'strapi::security',
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
"connect-src": ["'self'", "https:"],
"img-src": ["'self'", "data:", "blob:", "res.cloudinary.com"],
"media-src": ["'self'", "data:", "blob:", "res.cloudinary.com"],
'connect-src': ["'self'", 'https:'],
'img-src': [
"'self'",
'data:',
'blob:',
'dl.airtable.com',
'*.amazonaws.com',
],
'media-src': [
"'self'",
'data:',
'blob:',
'dl.airtable.com',
'*.amazonaws.com',
],
upgradeInsecureRequests: null,
},
},
},
},
];
'strapi::cors',
'strapi::poweredBy',
'strapi::logger',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
];
14 changes: 10 additions & 4 deletions config/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ module.exports = ({ env }) => ({
},
upload: {
config: {
provider: "cloudinary",
provider: 'aws-s3',
providerOptions: {
cloud_name: env("CLOUDINARY_NAME"),
api_key: env("CLOUDINARY_KEY"),
api_secret: env("CLOUDINARY_SECRET"),
accessKeyId: env('AWS_ACCESS_KEY_ID'),
secretAccessKey: env('AWS_ACCESS_SECRET'),
region: env('AWS_REGION'),
params: {
ACL: env('AWS_ACL', 'public-read'),
signedUrlExpires: env('AWS_SIGNED_URL_EXPIRES', 15 * 60),
Bucket: env('AWS_BUCKET'),
},
},
actionOptions: {
upload: {},
uploadStream: {},
delete: {},
},
},
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
},
"dependencies": {
"@ckeditor/strapi-plugin-ckeditor": "^0.0.7",
"@strapi/plugin-graphql": "^4.11.7",
"@strapi/plugin-i18n": "^4.11.7",
"@strapi/plugin-users-permissions": "^4.11.7",
"@strapi/provider-upload-cloudinary": "^4.11.7",
"@strapi/strapi": "^4.11.7",
"@strapi/plugin-graphql": "^4.13.1",
"@strapi/plugin-i18n": "^4.13.1",
"@strapi/plugin-users-permissions": "^4.13.1",
"@strapi/provider-upload-aws-s3": "^4.13.1",
"@strapi/strapi": "^4.13.1",
"fs": "^0.0.1-security",
"pg": "^8.11.1",
"pg-connection-string": "^2.6.1",
Expand Down
Loading

0 comments on commit 0c35428

Please sign in to comment.