🚀 DAY 3 OF LAUNCH WEEK:Announcing Bun and vlt Support in Socket.Learn more →
Socket
Book a DemoInstallSign in
Socket

@zrpaplicacoes/strapi-provider-upload-do

Package Overview
Dependencies
Maintainers
7
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zrpaplicacoes/strapi-provider-upload-do

Strapi Provider for Digital Ocean Spaces

latest
npmnpm
Version
0.0.1
Version published
Maintainers
7
Created
Source

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 : Base 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. (Optionnal - e.g. /example)
  • cdn : CDN Endpoint - URL of the cdn of the space (Optionnal - e.g. cdn.example.com)

How to use

  • Install this package using npm or yarn
npm i strapi-provider-upload-dos
yarn add strapi-provider-upload-dos
  • Create config in ./config/plugins with content (create if not exist (plugins.js))
module.exports = {
  upload: {
    config: {
      provider: "strapi-provider-upload-dos",
      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,
      },
    },
  },
};

  • 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 tutorial:

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

Parameter DO_SPACE_DIRECTORY and DO_SPACE_CDN is optional and you can ommit them both in .env and settings.

Modify the CSP roules and define the source

config/middlewares.js

module.exports = [
  "strapi::errors",
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": ["'self'", "https:"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            "*.digitaloceanspaces.com"
          ],
          "media-src": ["'self'", "data:", "blob:"],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
  "strapi::cors",
  "strapi::poweredBy",
  "strapi::logger",
  "strapi::query",
  "strapi::body",
  "strapi::favicon",
  "strapi::public",
];

Resources

Keywords

upload

FAQs

Package last updated on 09 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts