We're moving an app off a hand-rolled v1 setup that routes each upload to one of three buckets (images, quarantine for unscanned docs, general documents), each with its own credentials and endpoint. The client says which class of upload it is via metadata in the presign request, and the server picks the bucket from that.
With @upupjs/server 3.1.0 this routing can't be expressed:
storage in UpupServerConfig is a single static object (type/bucket/region/credentials), no function form
keyStrategy receives { userId, fileName, contentType, size } (dist/config-28bb05f8.d.ts) — no metadata, no request
hooks.onBeforeUpload does get the Request, but it can only return a boolean, it can't influence where the file goes
So createUpupHandler / createUpupNextHandler only fit single-bucket apps, and we had to keep our own presign route.
Would either of these be acceptable?
- allow
storage to be (ctx) => StorageConfig resolved per request, or
- pass the presign
metadata (and ideally the request) into keyStrategy
Happy to test a canary against a real multi-bucket setup.
We're moving an app off a hand-rolled v1 setup that routes each upload to one of three buckets (images, quarantine for unscanned docs, general documents), each with its own credentials and endpoint. The client says which class of upload it is via
metadatain the presign request, and the server picks the bucket from that.With
@upupjs/server3.1.0 this routing can't be expressed:storageinUpupServerConfigis a single static object (type/bucket/region/credentials), no function formkeyStrategyreceives{ userId, fileName, contentType, size }(dist/config-28bb05f8.d.ts) — nometadata, no requesthooks.onBeforeUploaddoes get theRequest, but it can only return a boolean, it can't influence where the file goesSo
createUpupHandler/createUpupNextHandleronly fit single-bucket apps, and we had to keep our own presign route.Would either of these be acceptable?
storageto be(ctx) => StorageConfigresolved per request, ormetadata(and ideally the request) intokeyStrategyHappy to test a canary against a real multi-bucket setup.