Strapi Upload Provider for Linode Object Storage
Parameters
- key : [storage access key]
- secret : [storage access secret]
-
endpoint : Base URL of the space (e.g.
ap-south-1.linodeobjects.com
) - space : Name of the s3 bucketName.
-
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.
cdn.example.com
)
How to use
1. Install this package
npm i strapi-provider-upload-linode
yarn add strapi-provider-upload-linode
pnpm add strapi-provider-upload-linode
.env
and add provide Linode config.
2. Create LI_OBJECT_S3_ACCESS_KEY=
LI_OBJECT_S3_SECRET_KEY=
LI_OBJECT_S3_ENDPOINT=
LI_OBJECT_S3_BUCKET_NAME=
LI_OBJECT_S3_DIRECTORY=
LI_OBJECT_S3_CDN=
Parameter LI_OBJECT_S3_DIRECTORY
and LI_OBJECT_S3_CDN
is optional and you can ommit them both in .env
and settings
.
./config/plugins.js
with content
3. Create or update config in module.exports = ({ env }) => ({
// ...
upload: {
config: {
provider: "strapi-provider-upload-linode",
providerOptions: {
key: env("LI_OBJECT_S3_ACCESS_KEY"),
secret: env("LI_OBJECT_S3_SECRET_KEY"),
endpoint: env("LI_OBJECT_S3_ENDPOINT"),
space: env("LI_OBJECT_S3_BUCKET_NAME"),
directory: env("LI_OBJECT_S3_DIRECTORY"), // optional
cdn: env("LI_OBJECT_S3_CDN"), // optional
},
},
},
// ...
});
4. Security Middleware Configuration
Due to the default settings in the Strapi Security Middleware you will need to modify the contentSecurityPolicy settings to properly see thumbnail previews in the Media Library. You should replace strapi::security string with the object bellow instead as explained in the middleware configuration documentation.
./config/middlewares.js
module.exports = [
// ...
{
name: "strapi::security",
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
"connect-src": ["'self'", "https:"],
"img-src": [
"'self'",
"data:",
"blob:",
"market-assets.strapi.io",
"yourBucketName.yourRegion.linodeobjects.com", // change here
],
"media-src": [
"'self'",
"data:",
"blob:",
"market-assets.strapi.io",
"yourBucketName.yourRegion.linodeobjects.com", // change here
],
upgradeInsecureRequests: null,
},
},
},
},
// ...
];