fix(core): update

This commit is contained in:
Philipp Kunz 2024-06-17 19:57:56 +02:00
parent bd8b05920f
commit a9bb31c2a2
2 changed files with 8 additions and 8 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartbucket',
version: '3.0.16',
version: '3.0.17',
description: 'A TypeScript library offering simple and cloud-agnostic object storage with advanced features like bucket creation, file and directory management, and data streaming.'
}

View File

@ -14,18 +14,18 @@ export class SmartBucket {
/**
* the constructor of SmartBucket
*/
constructor(configArg: plugins.tsclass.storage.IS3Descriptor) {
constructor(configArg: IS3Descriptor) {
this.config = configArg;
const endpoint = this.config.endpoint.startsWith('http://') || this.config.endpoint.startsWith('https://')
? this.config.endpoint
: `https://${this.config.endpoint}`;
const protocol = configArg.useSsl === false ? 'http' : 'https';
const endpoint = `${protocol}://${configArg.endpoint}`;
this.s3Client = new plugins.s3.S3Client({
endpoint,
region: this.config.region || 'us-east-1',
region: configArg.region || 'us-east-1',
credentials: {
accessKeyId: this.config.accessKey,
secretAccessKey: this.config.accessSecret,
accessKeyId: configArg.accessKey,
secretAccessKey: configArg.accessSecret,
},
forcePathStyle: true, // Necessary for S3-compatible storage like MinIO or Wasabi
});