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 = [
'strapi::logger',
'strapi::errors',
'strapi::security',
'strapi::cors',
'strapi::poweredBy',
'strapi::query',
'strapi::body',
'strapi::session',
'strapi::favicon',
'strapi::public',
const config = ({
env,
}: Core.Config.Shared.ConfigParams): Core.Config.Middlewares => [
"strapi::logger",
"strapi::errors",
{
name: "strapi::security",
config: {
contentSecurityPolicy: {
useDefaults: true,
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;

View file

@ -5,14 +5,26 @@ const config = ({
}: Core.Config.Shared.ConfigParams): Core.Config.Plugin => ({
upload: {
config: {
provider: "strapi-provider-cloudflare-r2",
provider: "aws-s3",
providerOptions: {
accessKeyId: env("CF_ACCESS_KEY_ID"),
secretAccessKey: env("CF_ACCESS_SECRET"),
endpoint: env("CF_ENDPOINT"),
params: {
Bucket: env("CF_BUCKET"),
baseUrl: env("R2_CDN_URL"),
rootPath: env("R2_CDN_ROOT_PATH"),
s3Options: {
credentials: {
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": {
"@strapi/plugin-cloud": "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/strapi": "5.47.1",
"better-sqlite3": "^12.10.0",
@ -24,7 +25,6 @@
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.0.0",
"strapi-provider-cloudflare-r2": "^0.3.0",
"strapi-v5-plugin-populate-deep": "^4.3.2",
"styled-components": "^6.0.0"
},