fix(core): update

This commit is contained in:
2024-06-17 16:01:35 +02:00
parent 8401fe1c0c
commit 535d9f8520
8 changed files with 1421 additions and 421 deletions

View File

@@ -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);
}
}
}