Skip to content

Strapi Upload Provider for Digital Ocean Spaces. This provider will upload to the space using the AWS S3 API.

License

Notifications You must be signed in to change notification settings

hardeath950/strapi-provider-upload-do-bbc

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Strapi Upload Provider for Digital Ocean Spaces

This provider will upload to the space using the AWS S3 API.

Parameters

  • key: Space access key
  • secret: Space access secret
  • endpoint: URL of the space (e.g. 'fra.digitaloceanspaces.com')
  • space: Name of the space in the Digital Ocean panel.
  • directory: Name of the sub-directory you want to store your files in. (Optional - e.g. '/example')
  • cdn: CDN Endpoint - URL of the CDN of the space (Optional - e.g. 'cdn.example.com')

How to use

  1. Install this package
// npm
npm i strapi-provider-upload-do-bbc

// yarn 
yarn add strapi-provider-upload-do-bbc
  1. Create or update (if exist) config
  • in strapi v3.x ./extensions/upload/config/settings.js
  • in strapi v4.x ./config/plugins.js

with content:

// for strapi v3.x
module.exports = {
  provider: "do-bbc",
  providerOptions: {
    key: process.env.DO_SPACE_ACCESS_KEY,
    secret: process.env.DO_SPACE_SECRET_KEY,
    endpoint: process.env.DO_SPACE_ENDPOINT,
    space: process.env.DO_SPACE_BUCKET,
    directory: process.env.DO_SPACE_DIRECTORY,
    cdn: process.env.DO_SPACE_CDN,
  }
}

// for strapi v4.x
module.exports = ({env}) => ({
  // ...
  upload: {
    config: {
      provider: "strapi-provider-upload-do-bbc", 
      providerOptions: {
        key: process.env.DO_SPACE_ACCESS_KEY,
        secret: process.env.DO_SPACE_SECRET_KEY,
        endpoint: process.env.DO_SPACE_ENDPOINT,
        space: process.env.DO_SPACE_BUCKET,
        directory: process.env.DO_SPACE_DIRECTORY,
        cdn: process.env.DO_SPACE_CDN,
      }
    },
  }, 
  // ...
})
  1. Create .env and add to them
DO_SPACE_ACCESS_KEY
DO_SPACE_SECRET_KEY
DO_SPACE_ENDPOINT
DO_SPACE_BUCKET
DO_SPACE_DIRECTORY
DO_SPACE_CDN

with values obtained from the tutorial:

https://www.digitalocean.com/community/tutorials/how-to-create-a-digitalocean-space-and-api-key

Parameter DO_SPACE_DIRECTORY and DO_SPACE_CDN are optional and you can omit them both in .env and settings.

Resources

Links

Contributors

About

Strapi Upload Provider for Digital Ocean Spaces. This provider will upload to the space using the AWS S3 API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%