Update settings to define multiple S3 buckets
VaZark opened this issue · comments
Vasanth commented
Use Case : When dealing with multitenant services, it'd be ideal if we could define the multiple S3 buckets for each client and dynamically set the bucket to use with django-storages.
Moreover, we do not have to look far for inspiration. We can reuse the Muti-Database dict format to handle and set the S3 bucket config. Users can then dynamically select the bucket with threading local or their preferred setup.
## settings.py
BUCKETS = {
"S3_1": {
"BUCKET_NAME": "",
"ENDPOINT_URL": "",
"MAX_AGE_SECONDS": "",
"PUBLIC_URL": "",
"FILE_OVERWRITE": "",
},
"S3_2": {
"BUCKET_NAME": "",
"ENDPOINT_URL": "",
"MAX_AGE_SECONDS": "",
"PUBLIC_URL": "",
"FILE_OVERWRITE": "",
}
}
Dave Hall commented
It's an interesting idea, but needs a bit more fleshing out.
- What advantage is there splitting different client objects over different buckets? AFAIK, S3 permissions are per-object in general.
- How would an individual file be routed to a particular bucket?