-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement new attachment handlers #3
base: develop
Are you sure you want to change the base?
Conversation
4cffc23
to
94c1801
Compare
…ment_data field" This change ends up being *mostly* backwards compatible since we still store the url, though this will be basically useless in the future. Attachment size is currently hardcoded to 8MB, in the future this should be able to be set by users.
af0f9ce
to
da3b814
Compare
Moves the attachment handling code to its own class and creates a new abstract class to allow different handlers in the future
Uses the MinIO S3 library
download_attachment & delete_attachment are currently stubs in bot implementations, and I'm not sure they're necessary for the API at the moment |
This comment was marked as outdated.
This comment was marked as outdated.
A list of dictionaries containing information about the uploaded attachments. | ||
""" | ||
attachments = [] | ||
tags = Tags.new_object_tags() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should include tag for bot ID to help people that are sharing a bucket between multiple bots that they host
As a note for use, Cloudflare and Backblaze both offer 10GB free on their S3 cloud storage systems (R2 & B2, respectively). Cloudflare has no egress fees and Backblaze has some only if you don't route through a CDN and download more than you store. |
…ia config The max size isn't automatically updated when the config is changed. The size is should always be retrieved from the attachment handler and not the config, as the attachment handler may have additional constraints
… handler is now 500
Should be pretty close to final at this point. Still iffy on the current s3 mongodb data format and if I should rename the mongodb datastore config value to "mongodb" from "internal" to reflect what it actually is. |
This seems to be a decent bucket access policy {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": [
"*"
]
},
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::modmail-attachments/*"
]
}
]
} |
Add noop attachment handler so the option to not save attachments exists. |
Ability to set retention period for mongodb storage may also be desired |
Adds an attachment handler interface and 2 new clients which implement it.
MongoAttachmentClient: stores attachments as binary data in a mongoDB document in the attachments collection
S3AttachmentClient: Stores attachments as S3 objects in an S3 service of the users choice.