Configuration

Files

Configuration for storage locations, metadata, upload limits, and transformations.
Environment Variables
Environment variables are configurable for Directus Business Cloud and Enterprise Cloud projects via our Customer Success team. You can also set environment variables in self-hosted projects.

By default, Directus stores all uploaded files locally on the file system or can also configure Directus to use external storage services. You can also configure multiple storage adapters at the same time which allows you to choose where files are being uploaded on a file-by-file basis.

In the Data Studio, files will automatically be uploaded to the first configured storage location (in this case local). The used storage location is saved under storage in the directus_files collection.

Storage Locations

VariableDescriptionDefault Value
STORAGE_LOCATIONSA comma separated list of storage locations. You can use any names you'd like for these keys.local

For each of the storage locations listed, you must provide the following configuration (variable name must be uppercase in these options):

VariableDescriptionDefault Value
STORAGE_<LOCATION>_DRIVERWhich driver to use, either local, s3, gcs, azure, cloudinary, supabase.
STORAGE_<LOCATION>_ROOTWhere to store the files on disk.''
STORAGE_<LOCATION>_HEALTHCHECK_THRESHOLDHealthcheck timeout threshold in ms.750

Based on your configured drivers, you must also provide additional variables, where <LOCATION> is the capitalized name of the item in the STORAGE_LOCATIONS value.

Local (local)

VariableDescriptionDefault Value
STORAGE_<LOCATION>_ROOTWhere to store the files on disk.

S3 (s3)

VariableDescriptionDefault Value
STORAGE_<LOCATION>_KEYUser key.
STORAGE_<LOCATION>_SECRETUser secret.
STORAGE_<LOCATION>_BUCKETS3 bucket.
STORAGE_<LOCATION>_REGIONS3 region.
STORAGE_<LOCATION>_ENDPOINT1S3 endpoint.s3.amazonaws.com
STORAGE_<LOCATION>_ACLS3 ACL.
STORAGE_<LOCATION>_SERVER_SIDE_ENCRYPTIONS3 server side encryption.
STORAGE_<LOCATION>_FORCE_PATH_STYLES3 force path style.false

1 When overriding this variable for S3, make sure to add your bucket's region in the endpoint: s3.{region}.amazonaws.com.

Google Cloud Storage (gcs)

VariableDescriptionDefault Value
STORAGE_<LOCATION>_KEY_FILENAMEPath to key file on disk.
STORAGE_<LOCATION>_BUCKETGoogle Cloud Storage bucket.

Azure (azure)

VariableDescriptionDefault Value
STORAGE_<LOCATION>_CONTAINER_NAMEAzure Storage container.
STORAGE_<LOCATION>_ACCOUNT_NAMEAzure Storage account name.
STORAGE_<LOCATION>_ACCOUNT_KEYAzure Storage key.
STORAGE_<LOCATION>_ENDPOINTAzure URL.https://{ACCOUNT_NAME}.blob.core.windows.net

Cloudinary (cloudinary)

VariableDescriptionDefault Value
STORAGE_<LOCATION>_CLOUD_NAMECloudinary cloud name.
STORAGE_<LOCATION>_API_KEYCloudinary API key.
STORAGE_<LOCATION>_API_SECRETCloudinary API secret.
STORAGE_<LOCATION>_ACCESS_MODEDefault access mode for the file. One of public, authenticated.

Cloudinary is supported only as a storage driver. Changes made on Cloudinary are not synced back to Directus, and Directus wo't_ rely on Cloudinary's asset transformations in the /assets endpoint.

Supabase (supabase)

VariableDescriptionDefault Value
STORAGE_<LOCATION>_SERVICE_ROLEThe admin service role JWT.
STORAGE_<LOCATION>_BUCKETStorage bucket.
STORAGE_<LOCATION>_PROJECT_IDProject ID.
STORAGE_<LOCATION>_ENDPOINTOptional custom endpoint.

Metadata

When uploading an image, Directus persists the description, title, and tags from available Exif metadata. For security purposes, collection of additional metadata must be configured:

VariableDescriptionDefault Value
FILE_METADATA_ALLOW_LISTA comma-separated list of metadata keys to collect during file upload. Use * for all1.ifd0.Make,ifd0.Model,exif.FNumber,exif.ExposureTime,exif.FocalLength,exif.ISOSpeedRatings

1: Extracting all metadata might cause memory issues when the file has an unusually large set of metadata

Upload Limits

VariableDescriptionDefault Value
FILES_MAX_UPLOAD_SIZEMaximum file upload size allowed. For example 10mb, 1gb, 10kb.
FILES_MIME_TYPE_ALLOW_LISTAllow list of mime types that are allowed to be uploaded. Supports glob syntax.*/*

Chunked Uploads

Large files can be uploaded in chunks to improve reliability and efficiency, especially in scenarios with network instability or limited bandwidth. This is implemented using the TUS protocol.

VariableDescriptionDefault Value
TUS_ENABLEDWhether or not to enable the chunked uploads.false
TUS_CHUNK_SIZEThe size of each file chunks. For example 10mb, 1gb, 10kb.10mb
TUS_UPLOAD_EXPIRATIONThe expiry duration for uncompleted files with no upload activity.10m
TUS_CLEANUP_SCHEDULECron schedule to clean up the expired uncompleted uploads.0 * * * *

Assets

VariableDescriptionDefault Value
ASSETS_CACHE_TTLHow long assets will be cached for in the browser. Sets the max-age value of the Cache-Control header.30d
ASSETS_TRANSFORM_MAX_CONCURRENTHow many file transformations can be done simultaneously.25
ASSETS_TRANSFORM_IMAGE_MAX_DIMENSIONThe max pixel dimensions size (width/height) that is allowed to be transformed.6000
ASSETS_TRANSFORM_TIMEOUTMax time spent trying to transform an asset.7500ms
ASSETS_TRANSFORM_MAX_OPERATIONSThe max number of transform operations that is allowed to be processed (excludes saved presets).5
ASSETS_INVALID_IMAGE_SENSITIVITY_LEVELLevel of sensitivity to invalid images. See the sharp.failOn option.warning

Image transformations can be heavy on memory usage. If you're using a system with 1GB or less available memory, we recommend lowering the allowed concurrent transformations to prevent you from overflowing your server.