fix(core): update
This commit is contained in:
@@ -1,22 +1,33 @@
|
||||
// classes.smartbucket.ts
|
||||
|
||||
import * as plugins from './plugins.js';
|
||||
import { Bucket } from './classes.bucket.js';
|
||||
|
||||
export class SmartBucket {
|
||||
public config: plugins.tsclass.storage.IS3Descriptor;
|
||||
|
||||
public minioClient: plugins.minio.Client;
|
||||
public s3Client: plugins.s3.S3Client;
|
||||
|
||||
/**
|
||||
* the constructor of SmartBucket
|
||||
*/
|
||||
/**
|
||||
* the constructor of SmartBucket
|
||||
*/
|
||||
constructor(configArg: plugins.tsclass.storage.IS3Descriptor) {
|
||||
this.config = configArg;
|
||||
this.minioClient = new plugins.minio.Client({
|
||||
endPoint: this.config.endpoint,
|
||||
port: configArg.port || 443,
|
||||
useSSL: configArg.useSsl !== undefined ? configArg.useSsl : true,
|
||||
accessKey: this.config.accessKey,
|
||||
secretKey: this.config.accessSecret,
|
||||
const endpoint = this.config.endpoint.startsWith('http://') || this.config.endpoint.startsWith('https://')
|
||||
? this.config.endpoint
|
||||
: `https://${this.config.endpoint}`;
|
||||
|
||||
this.s3Client = new plugins.s3.S3Client({
|
||||
endpoint,
|
||||
region: this.config.region || 'us-east-1',
|
||||
credentials: {
|
||||
accessKeyId: this.config.accessKey,
|
||||
secretAccessKey: this.config.accessSecret,
|
||||
},
|
||||
forcePathStyle: true, // Necessary for S3-compatible storage like MinIO or Wasabi
|
||||
});
|
||||
}
|
||||
|
||||
@@ -32,4 +43,4 @@ export class SmartBucket {
|
||||
public async getBucketByName(bucketName: string) {
|
||||
return Bucket.getBucketByName(this, bucketName);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user