Enable build support by adding .onedev-buildspec.yml
lib Loading last commit info...
.editorconfig
.gitignore
.npmignore
LICENSE
README.md
package.json
README.md

Strapi Openstack 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 Openstack Swift will only work with Strapi v4.9.0 or higher.


Installation

Add the following dependency to your package.json to pull in the custom Openstack Swift integration

"dependencies": {
  ...
  "tt-strapi-provider-openstack": "git+ssh://git@onedev.ops.thumbtribe.co.za:6611/TGL/tt-strapi-provider-openstack#v1.0",
},

Configuration

Add the two following configurations to complete the setup of the Openstack Swift integration

Provider Configuration

./config/plugins.js

module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: "tt-strapi-provider-openstack",
      providerOptions: {
        username: env('OPENSTACK_USERNAME'),
        password: env('OPENSTACK_PASSWORD'),
        authUrl: env('OPENSTACK_AUTH_URL'),
        region: env('OPENSTACK_REGION'),
        tenantId: env('OPENSTACK_PROJECT_ID'),
        keystoneAuthVersion: env('OPENSTACK_KST_AUTH_VERSION'),
        domainId: env('OPENSTACK_DOMAIN_ID'),
        container: env('OPENSTACK_CONTAINER'),
        cdnSslUri: env("OPENSTACK_CDN_SSL_URI"),
      },
      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.OPENSTACK_CDN_SSL_URI}`,
          ],
          "media-src": [
            "'self'",
            "data:",
            "blob:",
            `${process.env.OPENSTACK_CDN_SSL_URI}`,
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  // ...
];

Environment Variables

Environment variables required for the Openstack Swift integration

VariableTypeDefaultNote
OPENSTACK_USERNAMEString-
OPENSTACK_PASSWORDString-
OPENSTACK_AUTH_URLString-
OPENSTACK_KST_AUTH_VERSIONStringv3
OPENSTACK_REGIONString-
OPENSTACK_PROJECT_IDString-
OPENSTACK_DOMAIN_IDString-
OPENSTACK_CONTAINERString-
OPENSTACK_CDN_SSL_URIString-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
OPENSTACK_CDN_ACCESS_CONTROL_HEADERString-Usually assign a value of *
OPENSTACK_IS_PRIVATE_CONTAINERBooleantrue
OPENSTACK_TEMP_URL_KEYString-Required if OPENSTACK_IS_PRIVATE_CONTAINER is true
OPENSTACK_TEMP_URL_TTLInteger300Time to live of the generated temp URL in seconds
Please wait...
Page is in error, reload to recover