diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index d9cbc44..71a2c11 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -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.' } diff --git a/ts/classes.smartbucket.ts b/ts/classes.smartbucket.ts index 920515b..e742df7 100644 --- a/ts/classes.smartbucket.ts +++ b/ts/classes.smartbucket.ts @@ -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 });