Skip to main content

Storage Configuration

Qarion supports multiple file storage backends for attachments (product files, meeting notes, ticket attachments). The storage backend determines where uploaded files are physically stored and how they are retrieved.

Supported Backends

BackendIdentifierDescription
FilesystemfilesystemLocal server filesystem (default for development)
Amazon S3s3Amazon S3 or any S3-compatible object store (MinIO, DigitalOcean Spaces)
Google Cloud StoragegcsGoogle Cloud Storage buckets
Azure Blob StorageazureMicrosoft Azure Blob Storage containers
Base64base64Inline base64 encoding in the database (legacy, not recommended for production)

Configuring via Admin Panel

Navigate to Administration → System Settings → Storage to configure the storage backend. Settings saved here are stored in the database and take precedence over environment variables.

SettingKeyDescription
Backendstorage.backendOne of: filesystem, s3, gcs, azure, base64

S3 Settings

SettingKeyDescription
Bucketstorage.s3_bucketS3 bucket name
Regionstorage.s3_regionAWS region (e.g., eu-west-1)
Prefixstorage.s3_prefixOptional path prefix within the bucket
Access Keystorage.s3_access_keyAWS access key ID
Secret Keystorage.s3_secret_keyAWS secret access key

Google Cloud Storage Settings

SettingKeyDescription
Bucketstorage.gcs_bucketGCS bucket name
Prefixstorage.gcs_prefixOptional path prefix
Credentials JSONstorage.gcs_credentials_jsonService account JSON key

Azure Blob Settings

SettingKeyDescription
Connection Stringstorage.azure_connection_stringAzure storage connection string
Containerstorage.azure_containerBlob container name
Prefixstorage.azure_prefixOptional path prefix

Filesystem Settings

SettingKeyDescription
Upload Directorystorage.local_dirLocal directory path for uploads

Configuring via Environment Variables

For deployments where database-level configuration is not desired, set the following environment variables:

# Backend selection
STORAGE_BACKEND=s3

# S3 configuration
STORAGE_S3_BUCKET=qarion-attachments
STORAGE_S3_REGION=eu-west-1
STORAGE_S3_PREFIX=uploads/
STORAGE_S3_ACCESS_KEY=AKIA...
STORAGE_S3_SECRET_KEY=secret...

Database settings (configured via the admin panel) always take precedence over environment variables.

How It Works

Qarion uses a factory pattern to resolve the active storage handler at runtime. The StorageHandlerFactory checks for database overrides first, then falls back to environment variable defaults. This means you can:

  1. Set environment variables as defaults for all instances
  2. Override per-instance via the admin panel

All attachment operations (upload, download, delete) go through the resolved storage handler, making the storage backend transparent to the rest of the application.

Best Practices

Use S3 or GCS for Production

Local filesystem storage is convenient for development but does not scale across multiple application servers. For production deployments, use S3, GCS, or Azure Blob Storage.

Set a Path Prefix

Use a path prefix to organize files within your bucket (e.g., qarion/prod/attachments/). This makes it easier to manage permissions, lifecycle rules, and backups.

Secure Your Credentials

Storage credentials should be treated as secrets. Use environment variables or a secrets manager rather than storing them in plaintext configuration files.

Learn More