@breezertwo/strapi-provider-upload-digitalocean
v5.0.3
Published
Digital ocean spaces provider for Strapi asset upload
Downloads
34
Maintainers
Readme
Strapi Upload Provider for Digital Ocean Spaces
A provider to easily upload media library content to a Digital Ocean Space using the AWS S3 API. With configuration options to use CDN URLs and sub-directory support.
Parameters
- key : Space access key
- secret : Space access secret
- endpoint : Base URL of the space (e.g.
https://fra.digitaloceanspaces.com) - space : Name of the space in the Digital Ocean panel. (e.g.
myspace) - region : Region of the space (e.g.
fra1- defaults tofra1if not provided) - directory : Name of the sub-directory you want to store your files in. (Optionnal - e.g.
/example) - cdn : CDN Endpoint - URL of the cdn of the space (Optionnal - e.g.
https://fra.cdn.digitaloceanspaces.com)
How to use
1. Install this package
npm i @breezertwo/strapi-provider-upload-digitalocean2. Create or update config in ./config/plugins.js of your strapi project.
Its best to add the values to your environment variables and then use them in the config as follows:
module.exports = ({env}) => ({
// ...
upload: {
config: {
provider: "@breezertwo/strapi-provider-upload-digitalocean",
providerOptions: {
key: env('DO_SPACE_ACCESS_KEY'),
secret: env('DO_SPACE_SECRET_KEY'),
endpoint: env('DO_SPACE_ENDPOINT'),
space: env('DO_SPACE_BUCKET'),
region: env('DO_SPACE_REGION'),
directory: env('DO_SPACE_DIRECTORY'), // Optional
cdn: env('DO_SPACE_CDN'), // Optional
}
},
},
// ...
})
### 3. Change security setting in middleware.js to allow image thumbnails beeing loaded in strapi dashboard
```js
module.exports = ({ env }) => ({
// ...
{
name: "strapi::security",
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
"connect-src": ["'self'", "https:"],
"img-src": [
"'self'",
"data:",
"blob:",
"<you digital ocean space endpoint or cdn domain>",
],
"media-src": [
"'self'",
"data:",
"blob:",
"<you digital ocean space endpoint or cdn domain>",
],
upgradeInsecureRequests: null,
},
},
},
},
// ...
})Links
- This provider is a fork of a repo originally created by AdamZikmund and then forked as strapi-provider-upload-do
- MIT License
- Strapi website
