Multiple loaders configured at once
See original GitHub issueIt would be nice to be able to configure multiple loaders at once, e.g. URL & S3 loader like we do with the detectors:
LOADER = [
'tc_aws.loaders.s3_loader',
'thumbor.loaders.http_loader'
]
Thus the following URLs would get handled differently:
https://thumbor-server/fit-in/400x300/my/s3/image.png -> handled by tc_aws.loaders.s3_loader https://thumbor-server/fit-in/400x300/https://example.com/my/url/image.png -> handled by thumbor.loaders.http_loader, as tc_aws.loaders.s3_loader failed to load the image
This would allow for stacking multiple loaders and would make the thumbor.loaders.file_loader_http_fallback
obsolete, as this could be handled by configuring the file and http loader.
We currently need this feature for the s3 loader and this loader has no fallback, like the default file loader. This change in handling loaders would it make obsolete to have a fallback for each loader implementation.
What do you guys think?
_Edit: Correction, the s3 loader actually has a http fallback (TC_AWS_ENABLE_HTTP_LOADER), see https://github.com/thumbor-community/aws_
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:10 (4 by maintainers)
Hey @bkonetzny I prefer to keep it simpler. If we introduce this logic, we would have to change our loaders to actually perform the logic you described whereas if we just introduce a new loader (
FallbackLoader
?) we can be explicit on what the user wants.Something like you described would be the config for this loader:
That way we keep thumbor working the way it is, this pattern already exists in the codebase (
MixedStorage
) and it keeps working with whatever loader is out there.The first loader that responds without error “wins”. What do you guys think?
Go ahead! 😃