Skip to main content

File Storage Configuration (Optional)

By default, all media files (uploads, attachments, etc.) generated by WhautoMail are stored locally on your server. For better scalability, durability, and resilience, you can optionally configure external object storage using one of the supported providers: AWS S3, Google Cloud Storage (GCS), or Cloudflare R2.

Note: You should only configure a single storage provider (AWS S3, GCS, or R2) at a time, not multiple providers simultaneously.

Why Use External File Storage?

  • Offload media files from your application server
  • Improve performance and scalability
  • Enable secure, presigned URLs for file access
  • Recommended for production deployments

Configuration Steps

Option 1: AWS S3 Configuration

  1. Create an S3 bucket in your AWS account.
  2. Generate an IAM user with access to the bucket and obtain the Access Key ID and Secret Access Key.
  3. Update your web-server.env file with the following (uncomment and fill in your details):
# AWS S3 Configuration
AWS_BUCKET_NAME='your-bucket-name'
AWS_ACCESS_KEY_ID='your_aws_access_key'
AWS_SECRET_ACCESS_KEY='your_aws_secret_key'
AWS_REGION='us-east-1'
AWS_PRESIGNED_EXPIRY='43200'

Option 2: Google Cloud Storage (GCS) Configuration

  1. Create a GCS bucket in your Google Cloud project.
  2. Create a service account with Storage Object Admin role and generate a key.
  3. Update your web-server.env file with the following (uncomment and fill in your details):
# Google Cloud Storage Configuration
GCS_BUCKET='your-bucket-name'
GCP_PROJECT_ID='your-project-id'
GCP_PRIVATE_KEY_ID='your-private-key-id'
GCP_PRIVATE_KEY='your-private-key'
GCP_CLIENT_EMAIL='your-service-account-email'
GCP_CLIENT_ID='your-client-id'
GCS_BUCKET_PREFIX='optional-prefix'
GCS_PRESIGNED_EXPIRY_SECONDS='86400'
GCP_AUTH_URI='your_gcp_auth_uri'
GCP_TOKEN_URI='your_gcp_token_uri'
GCP_AUTH_PROVIDER_X509_CERT_URL='your_gcp_auth_provider_x509_cert_url'
GCP_CLIENT_X509_CERT_URL='your_gcp_client_x509_cert_url'
GCP_UNIVERSE_DOMAIN='your_gcp_universe_domain'

Option 3: Cloudflare R2 Configuration

Cloudflare R2 can also be used as an external object storage backend. This is useful if you already use Cloudflare for DNS/proxying or want low-cost, S3-compatible storage.

Update your web-server.env file with the following (uncomment and fill in your details):

# Cloudflare R2 Configuration (Optional)
R2_ACCOUNT_ID='your-cloudflare-account-id'
R2_ACCESS_KEY_ID='your-r2-access-key-id'
R2_SECRET_ACCESS_KEY='your-r2-secret-access-key'
R2_BUCKET_NAME='your-r2-bucket-name'
R2_BUCKET_PREFIX='optional-prefix'
R2_DIRECT_ACCESS='false'
R2_BASE_URL='your-custom-domain-url'
R2_PRESIGNED_URL='true'
R2_PRESIGNED_EXPIRY='3600'

Additional Notes

  • If none of the external providers (AWS S3, GCS, or Cloudflare R2) is configured, all files will be stored locally on your server (default).
  • Make sure to keep your cloud credentials secure and never share them publicly.

For more details, refer to the official AWS S3, Google Cloud Storage, and Cloudflare R2 documentation, or contact WhautoMail support if you need help choosing and configuring a storage option.