change provider to s3

This commit is contained in:
nicwands 2026-06-15 09:52:12 -04:00
parent 56d094006e
commit 4b3bf78366
4 changed files with 1610 additions and 307 deletions

View file

@ -1,16 +1,43 @@
import type { Core } from '@strapi/strapi'; import type { Core } from "@strapi/strapi";
const config: Core.Config.Middlewares = [ const config = ({
'strapi::logger', env,
'strapi::errors', }: Core.Config.Shared.ConfigParams): Core.Config.Middlewares => [
'strapi::security', "strapi::logger",
'strapi::cors', "strapi::errors",
'strapi::poweredBy', {
'strapi::query', name: "strapi::security",
'strapi::body', config: {
'strapi::session', contentSecurityPolicy: {
'strapi::favicon', useDefaults: true,
'strapi::public', directives: {
"connect-src": ["'self'", "https:"],
"img-src": [
"'self'",
"data:",
"blob:",
"market-assets.strapi.io",
"r2.nicwands.com",
],
"media-src": [
"'self'",
"data:",
"blob:",
"market-assets.strapi.io",
"r2.nicwands.com",
],
upgradeInsecureRequests: null,
},
},
},
},
"strapi::cors",
"strapi::poweredBy",
"strapi::query",
"strapi::body",
"strapi::session",
"strapi::favicon",
"strapi::public",
]; ];
export default config; export default config;

View file

@ -5,14 +5,26 @@ const config = ({
}: Core.Config.Shared.ConfigParams): Core.Config.Plugin => ({ }: Core.Config.Shared.ConfigParams): Core.Config.Plugin => ({
upload: { upload: {
config: { config: {
provider: "strapi-provider-cloudflare-r2", provider: "aws-s3",
providerOptions: { providerOptions: {
accessKeyId: env("CF_ACCESS_KEY_ID"), baseUrl: env("R2_CDN_URL"),
secretAccessKey: env("CF_ACCESS_SECRET"), rootPath: env("R2_CDN_ROOT_PATH"),
endpoint: env("CF_ENDPOINT"), s3Options: {
params: { credentials: {
Bucket: env("CF_BUCKET"), accessKeyId: env("R2_ACCESS_KEY_ID"),
secretAccessKey: env("R2_ACCESS_SECRET"),
}, },
region: "auto",
endpoint: env("R2_ENDPOINT"),
params: {
Bucket: env("R2_BUCKET"),
},
},
},
actionOptions: {
upload: {},
uploadStream: {},
delete: {},
}, },
}, },
}, },

1838
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -17,6 +17,7 @@
"dependencies": { "dependencies": {
"@strapi/plugin-cloud": "5.47.1", "@strapi/plugin-cloud": "5.47.1",
"@strapi/plugin-users-permissions": "5.47.1", "@strapi/plugin-users-permissions": "5.47.1",
"@strapi/provider-upload-aws-s3": "^5.48.0",
"@strapi/provider-upload-local": "^5.47.1", "@strapi/provider-upload-local": "^5.47.1",
"@strapi/strapi": "5.47.1", "@strapi/strapi": "5.47.1",
"better-sqlite3": "^12.10.0", "better-sqlite3": "^12.10.0",
@ -24,7 +25,6 @@
"react": "^18.0.0", "react": "^18.0.0",
"react-dom": "^18.0.0", "react-dom": "^18.0.0",
"react-router-dom": "^6.0.0", "react-router-dom": "^6.0.0",
"strapi-provider-cloudflare-r2": "^0.3.0",
"strapi-v5-plugin-populate-deep": "^4.3.2", "strapi-v5-plugin-populate-deep": "^4.3.2",
"styled-components": "^6.0.0" "styled-components": "^6.0.0"
}, },