1.1.2 • Published 3 months ago

@tanglemedia/directus-extension-media-storage v1.1.2

Weekly downloads
-
License
-
Repository
-
Last release
3 months ago

directus-extension-media-storage

This extension allows a Directus extension to use multiple storage adapters based on rules. This extension supports the use of local and cloudinary storage locations.

Installations

Add this extension inside the extensions folder of your Directus project.

.env variables

As of now, this extension supports local as the default storage and cloudinary as the secondary storage:

On your Directus .env file, add the following required variables

STORAGE_LOCATIONS="local,cloudinary"

This is a CSV of storage adapters that you want to use. For the complete list of adapters, refer here. For now, you can only use local (primary) and cloudinary (secondary). Always put local in the list first.

Local Storage Config

STORAGE_LOCAL_DRIVER="local"  
STORAGE_LOCAL_ROOT="./uploads"

Cloudinary Config

STORAGE_CLOUDINARY_DRIVER="cloudinary"

This is where your cloudinary files will be stored. Be sure to create a folder on your Cloudinary account first.

STORAGE_CLOUDINARY_ROOT="<cloudinary_folder>"

Enter your Clodudinary account details

STORAGE_CLOUDINARY_HEALTHCHECK_THRESHOLD=750
STORAGE_CLOUDINARY_CLOUD_NAME="<value>"
STORAGE_CLOUDINARY_API_KEY="<value>"
STORAGE_CLOUDINARY_API_SECRET="<value>"
STORAGE_CLOUDINARY_ACCESS_MODE="public"

CSV of files you want to upload to cloudinary

MEDIA_STORAGE_CLOUDINARY_MIME_TYPE_ALLOW_LIST="image/*"

Maximum file size for cloudinary in MB You should set this value at 100mb or less, if blank, the default value is 100mb

MEDIA_STORAGE_CLOUDINARY_MAXIMUM_FILE_SIZE=100

Blacklisted folder. Folders that you want to exclude from the cloudinary upload

MEDIA_STORAGE_CLOUDINARY_BLACKLIST_FOLDER="bda70046-71c2-4362-98d6-c38c55e50a4d,c3d00c3f-d2aa-42c6-8c70-00d60145cf4f,422f3293-2e02-45c7-a36c-3c95fd75b504"

Toggle this if we want to keep the file on both cloudinary and local. Defaults to false

MEDIA_STORAGE_CLOUDINARY_KEEP_LOCAL_COPY=false