backblaze-b2
backblaze-b2 copied to clipboard
Use b2_authorize_account allowed bucketId as default
Looks like #63 hasn't been touched in a few months, seems like a nice feature to have!
If you provide/update test coverage for this feature, I'd be on board with the changes.
Would you prefer the individual tests be added to each of the API test groups or would a new test suite that just verifies that defaultBucketId
is properly merged into all outgoing request bodies as bucketId
(when bucketId / bucketName are omitted from options)?
The latter is fine.
@Klowner Any chance this can be merged soon? Looks like a great optimization!
@adrw feel like writing some tests? :)
This has been sitting here over 2 years. When will this be merged?
Having the associated bucketId also helps determine whether a master key or an application key has been used since a master key does not have an association with an individual bucket but an application key can.
For now I'll have to look for another package.
I ended up patching lib/utils.js to get this functionality. I also added bucketName since it is required by downloadFileByName
+ if (authResponse.allowed) {
+ context.defaultBucketId = authResponse.allowed.bucketId || '';
+ context.defaultBucketName = authResponse.allowed.bucketName || '';
+ }