| lib | Loading last commit info... | |
| .editorconfig | ||
| .gitignore | ||
| .npmignore | ||
| LICENSE | ||
| README.md | ||
| package.json |
Strapi Rackspace Provider | Thumbtribe
This library has been forked from the official Strapi Rackspace provider plugin, found at https://github.com/strapi/strapi/tree/master/packages/providers/upload-rackspace.
The features for private containers on Rackspace will only work with Strapi
v4.9.0or higher.
Installation
Add the following dependency to your package.json to pull in the custom Rackspace integration
"dependencies": {
...
"tt-strapi-provider-rackspace": "git+ssh://onedev.ops.thumbtribe.co.za:6611/TGL/tt-strapi-provider-rackspace#v2.0",
},
Configuration
Add the two following configurations to complete the setup of the Rackspace integration
Provider Configuration
./config/plugins.js
module.exports = ({ env }) => ({
// ...
upload: {
config: {
provider: "tt-strapi-provider-rackspace",
providerOptions: {
username: env("RACKSPACE_USERNAME"),
apiKey: env("RACKSPACE_KEY"),
region: env("RACKSPACE_REGION"),
container: env("RACKSPACE_CONTAINER"),
},
actionOptions: {
upload: {},
uploadStream: {},
delete: {},
},
},
},
// ...
});
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 below 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:",
`${process.env.RACKSPACE_CDN_SSL_URI}`,
],
"media-src": [
"'self'",
"data:",
"blob:",
`${process.env.RACKSPACE_CDN_SSL_URI}`,
],
upgradeInsecureRequests: null,
},
},
},
},
// ...
];
Environment Variables
Environment variables required for the Rackspace integration
| Variable | Type | Default | Note |
|---|---|---|---|
| RACKSPACE_USERNAME | String | - | |
| RACKSPACE_KEY | String | - | |
| RACKSPACE_REGION | String | - | |
| RACKSPACE_CONTAINER | String | - | |
| RACKSPACE_CDN_SSL_URI | String | - | If the container is public then the value needs to be the containers public HTTPS URL. If the container is private then the value needs to be https://storage101.lon3.clouddrive.com |
| RACKSPACE_CDN_ACCESS_CONTROL_HEADER | String | - | Usually assign a value of * |
| RACKSPACE_IS_PRIVATE_CONTAINER | Boolean | true | |
| RACKSPACE_TEMP_URL_KEY | String | - | Required if RACKSPACE_IS_PRIVATE_CONTAINER is true |
| RACKSPACE_TEMP_URL_TTL | Integer | 300 | Time to live of the generated temp URL in seconds |