npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

azure-storage-provider-strapi

v0.2.3

Published

lib of upload files to blob storage private

Downloads

13

Readme

Publish to NPM Application Tests

Azure Storage Provider for Strapi

This is a Strapi provider for Azure Storage, allowing you to utilize Azure Blob Storage for your Strapi media uploads.

In this library, we leverage the @azure/storage-blob package to interact with Azure Blob Storage and implement the strapi-provider-upload interface. With this provider, you can seamlessly upload, delete, and retrieve the URL of files from Azure Blob Storage, whether stored publicly or privately.

Features

  • Provider Instance: Obtain the provider instance for Azure Blob Storage.
  • Upload: Easily upload files to Azure Blob Storage.
  • Delete: Effortlessly delete files from Azure Blob Storage.
  • Get URL: Retrieve the URL of files stored in Azure Blob Storage.
  • Get Signed URLs: Access signed URLs for files stored in Azure Blob Storage, particularly useful for private storage scenarios.

Installation

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

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

Configuration

/config/plugin.ts

module.exports = ({ env }) => ({
// ...
  upload: {
    config: {
      provider: "azure-storage-provider-strapi",
      providerOptions: {
        account: env("STORAGE_ACCOUNT"),
        accountKey: env("STORAGE_ACCOUNT_KEY"),
        sasToken: env("STORAGE_ACCOUNT_SAS_TOKEN"),
        serviceBaseURL: env("STORAGE_URL"),
        cdnBaseURL: env("STORAGE_CDN_URL"),
        containerName: env("STORAGE_CONTAINER_NAME", "myPrivateContainer"),
        defaultPath: env("STORAGE_DEFAULT_PATH","assets"),
        createContainerIfNotExists: ('STORAGE_CREATE_CONTAINER_NOT_EXISTES' ,false),
        blobLinkExpirationTime: env("STORAGE_SIGNED_URL_EXPIRES_TIME", 24),
        uploadOptions: {
          bufferSize: env("STORAGE_BUFFER_SIZE"),
          maxConcurrency: env("STORAGE_MAX_CONCURRENCY", 10),
        },
      },
    },
  },
  // ...
});

/config/middlewares.ts

export default [
  // ...,
  {
    name: "strapi::security",
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          "connect-src": ["'self'", "https:"],
          "img-src": [
            "'self'",
            "data:",
            "blob:",
            "https://market-assets.strapi.io",
            /**
             * Note: If using a STORAGE_URL replace `https://${process.env.STORAGE_ACCOUNT}.blob.core.windows.net` w/ process.env.STORAGE_URL
             * If using a CDN URL make sure to include that url in the CSP headers process.env.STORAGE_CDN_URL
             */
            `https://${process.env.STORAGE_ACCOUNT}.blob.core.windows.net`,
          ],
          "media-src": [
            "'self'",
            "data:",
            "blob:",
            `https://${process.env.STORAGE_ACCOUNT}.blob.core.windows.net`,
          ],
          upgradeInsecureRequests: null,
        },
      },
    },
  },
// ...
];

Environments

STORAGE_ACCOUNT=your_storage_account <"without .blob.core.windows.net">
STORAGE_ACCOUNT_KEY=your_storage_account_key
STORAGE_ACCOUNT_SAS_TOKEN=your_storage_account_sas_token
STORAGE_URL=your_storage_url <"without .blob.core.windows.net">
STORAGE_CDN_URL=your_cdn_url <"optional">
STORAGE_CONTAINER_NAME=your_container_name
STORAGE_DEFAULT_PATH=your_default_path <"default assets">
STORAGE_SIGNED_URL_EXPIRES_TIME=your_signed_url_expires_time  <"default 1">
STORAGE_BUFFER_SIZE=your_buffer_size <"default (4*1024*1024)4mb">
STORAGE_MAX_CONCURRENCY=your_max_concurrency <"default 20">
STORAGE_CREATE_CONTAINER_NOT_EXISTES=boolean_if_create_container_not_exists <"default false">