Skip to content

jorgeAgoiz/strapi-provider-storage-appwrite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strapi-provider-storage-appwrite

Appwrite logo Strapi logo

Resources

Links

Installation

# using yarn
yarn add strapi-provider-storage-appwrite

# using npm
npm install strapi-provider-storage-appwrite --save

Configuration

  • provider defines the name of the provider, in this case we must put "strapi-provider-storage-appwriter".
  • providerOptions is passed down during the construction of the provider. (ex: new StorageClient(config)).
  • providerOptions.apiUrl RESTful endpoint to manage your Appwrite project.
  • providerOptions.projectId ID of your Appwrite project.
  • providerOptions.bucketId ID of your Appwrite bucket.
  • sizeLimit maximum size limit for your files on bytes.

See the documentation about using a provider for information on installing and using a provider. To understand how environment variables are used in Strapi, please refer to the documentation about environment variables.

Provider Configuration

./config/plugins.js or ./config/plugins.ts for TypeScript projects:

module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: "strapi-provider-storage-appwrite",
      providerOptions: {
        apiUrl: env("APPWRITE_API_ENDPOINT"),
        projectId: env("APPWRITE_PROJECT_ID"),
        bucketId: env("APPWRITE_BUCKET_ID"),
      },
      sizeLimit: 1000000000,
      actionOptions: {
        upload: {},
        uploadStream: {},
        delete: {},
        checkFileSize: {},
      },
    },
  },
  // ...
});

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: {
        directives: {
          "default-src": ["'self'"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            env("APPWRITE_API_DIRECTIVE"),
            // Example: "https://cloud.appwrite.io"
          ],
        },
      },
    },
  },
  // ...
];

About

Appwrite provider for Strapi CMS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published