Browse Source

Merge pull request #4189 from nocodb/fix/backblaze

fix: backblaze region format
pull/4207/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
0f2d28a11e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts
  2. 8
      packages/nocodb/src/lib/plugins/backblaze/index.ts

14
packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts

@ -73,6 +73,16 @@ export default class Backblaze implements IStorageAdapterV2 {
});
}
patchRegion(region: string): string {
// in v0.0.1, we constructed the endpoint with `region = s3.us-west-001`
// in v0.0.2, `region` would be `us-west-001`
// as backblaze states Region is the 2nd part of your S3 Endpoint in documentation
if (region.startsWith('s3.')) {
region = region.slice(3);
}
return region;
}
public async fileDelete(_path: string): Promise<any> {
return Promise.resolve(undefined);
}
@ -94,14 +104,14 @@ export default class Backblaze implements IStorageAdapterV2 {
public async init(): Promise<any> {
const s3Options: any = {
params: { Bucket: this.input.bucket },
region: this.input.region,
region: this.patchRegion(this.input.region),
};
s3Options.accessKeyId = this.input.access_key;
s3Options.secretAccessKey = this.input.access_secret;
s3Options.endpoint = new AWS.Endpoint(
`${this.input.region}.backblazeb2.com`
`s3.${s3Options.region}.backblazeb2.com`
);
this.s3Client = new AWS.S3(s3Options);

8
packages/nocodb/src/lib/plugins/backblaze/index.ts

@ -6,7 +6,7 @@ import BackblazePlugin from './BackblazePlugin';
const config: XcPluginConfig = {
builder: BackblazePlugin,
title: 'Backblaze B2',
version: '0.0.1',
version: '0.0.2',
logo: 'plugins/backblaze.jpeg',
tags: 'Storage',
description:
@ -24,21 +24,21 @@ const config: XcPluginConfig = {
{
key: 'region',
label: 'Region',
placeholder: 'Region',
placeholder: 'e.g. us-west-001',
type: XcType.SingleLineText,
required: true,
},
{
key: 'access_key',
label: 'Access Key',
placeholder: 'Access Key',
placeholder: 'i.e. keyID in App Keys',
type: XcType.SingleLineText,
required: true,
},
{
key: 'access_secret',
label: 'Access Secret',
placeholder: 'Access Secret',
placeholder: 'i.e. applicationKey in App Keys',
type: XcType.Password,
required: true,
},

Loading…
Cancel
Save