Use case: I don't want to expose internal information about my images. But I don't want to map every possible image ID to something opaque.
Create a prefix mapper. Could be configuration that just points to a file, or it could be a plugin. Config may be easier. Could even be 100% config and have no file, just a list of mappings. May need both to cover complex setups, though.
May be worth redefining the id-to-path plugin hook to be something more like "translateID" so it's usable by other plugins and can be way more cool if necessary. Then config can be fairly simple but a plugin could add more complex use-cases.
For the built-in translation, we just use prefixes. If an id string has a prefix of one of the maps, we replace the prefix with its mapping.
This won't look great as an ENV variable, but if we want it to be extremely easy to configure, it needs to be configurable in the environment. e.g.:
This make any id starting with collection1- translate under the hood to s3:bucket1:, so that, e.g., collection1-giovanni.jp2 is what the public would see if inspecting the code, but s3:bucket1:giovanni.jp2 is what RAIS resolves.
Use case: I don't want to expose internal information about my images. But I don't want to map every possible image ID to something opaque.
This won't look great as an ENV variable, but if we want it to be extremely easy to configure, it needs to be configurable in the environment. e.g.:
export RAIS_ID_MAPS="collection1-=s3:bucket1:||collection2-=s3:bucket2:"
This make any id starting with
collection1-
translate under the hood tos3:bucket1:
, so that, e.g.,collection1-giovanni.jp2
is what the public would see if inspecting the code, buts3:bucket1:giovanni.jp2
is what RAIS resolves.