Code Monkey home page Code Monkey logo

strapi-provider-upload-do's Introduction

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

  1. Install this package
npm i strapi-provider-upload-do
yarn add strapi-provider-upload-do
pnpm add strapi-provider-upload-do
  1. Create or update config in ./config/plugins.js with content
module.exports = ({env}) => ({
  // ...
  upload: {
    config: {
      provider: "strapi-provider-upload-do", 
      providerOptions: {
        key: env('DO_SPACE_ACCESS_KEY'),
        secret: env('DO_SPACE_SECRET_KEY'),
        endpoint: env('DO_SPACE_ENDPOINT'),
        space: env('DO_SPACE_BUCKET'),
        directory: env('DO_SPACE_DIRECTORY'),
        cdn: env('DO_SPACE_CDN'),
      }
    },
  }, 
  // ...
})
  1. Create .env and add provide Digital Ocean config.
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.

Resources

Links

Contributors

strapi-provider-upload-do's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

strapi-provider-upload-do's Issues

Missing required key 'Bucket' in params

  upload: {
    config: {
      provider: 'strapi-provider-upload-do',
      providerOptions: {
        key: env('DO_SPACE_ACCESS_KEY'),
        secret: env('DO_SPACE_SECRET_KEY'),
        endpoint: env('DO_SPACE_ENDPOINT'),
        space: env('DO_SPACE_BUCKET'),
        cdn: env('DO_SPACE_CDN'),
        directory: env('DO_SPACE_DIR'),
      },
    },
  },
MissingRequiredParameter: Missing required key 'Bucket' in params
     at ParamValidator.fail (/app/node_modules/@strapi/provider-upload-aws-s3/node_modules/aws-sdk/lib/param_validator.js:50:37)

This seems to be an issue related to AWS notifications

(node:3496095) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.

Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)

Thank you for helping us get a very good package.
I get that message on my terminal when running my strapi v3.6 app. Along with that is the function of uploading images that can no longer work as before.
Hopefully we can find the problem and fix it soon.

I'm assuming the inability to post images and the above message (of AWS) are related.

Once again thank you very much team.

Strapi + Digital Ocean Spaces on localhost (CORS issue)

Hello,
In order to make the strapi-provider-upload-do work on localhost I had to customize the strapi::security in middlewares.js. Otherwise, all the links in the preview would be broken.

I used this config:

  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'connect-src': ["'self'", 'https:'],
          'img-src': [
            "'self'",
            'data:',
            'blob:',
            'dl.airtable.com',
            'MY-DO-SPACES-URL.digitaloceanspaces.com',
          ],
          'media-src': [
            "'self'",
            'data:',
            'blob:',
            'dl.airtable.com',
            'MY-DO-SPACES-URL.digitaloceanspaces.com',
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },

Questions:

  • Should this be added to the docs?
  • Is this the correct config?
  • Is this a security concern?
  • Is this needed only locally or also for production? (Haven't been able to deploy yet, so I'm not sure. Will update when I do.)

Upgrade to use v3 AWS SDK for Javascript

Update the code to use use AWS SDK V3.

Note, this was mentioned in issue #15, but it was not the focus of the issue, so moving it into an issue that focuses on it.

As part of this work, would it be worth adding typescript support?

Convert to use Typescript

It may be useful to convert the project to use Typescript.

At the same time, it maybe worth waiting until after issue #20 is implemented? Based on initial attempt showing it is less straightforward than expected.

Please upgrade urijs => 1.19.10

I use dependency-scan and it worked out like this.

urijs  <=1.19.10
Severity: high
Incorrect protocol extraction via \r, \n and \t characters - https://github.com/advisories/GHSA-3vjf-82ff-p4r3
URL Confusion When Scheme Not Supplied in medialize/uri.js - https://github.com/advisories/GHSA-g694-m8vq-gv9h
Hostname spoofing via backslashes in URL  - https://github.com/advisories/GHSA-89gv-h8wf-cg8r
Open Redirect in urijs - https://github.com/advisories/GHSA-8h2f-7jc4-7m3m
Leading white space bypasses protocol validation - https://github.com/advisories/GHSA-gmv4-r438-p67f
Authorization Bypass Through User-Controlled Key in urijs - https://github.com/advisories/GHSA-gcv8-gh4r-25x6

Please upgrade urijs to more than 1.19.10.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.