Skip to content

Commit

Permalink
Merge pull request #13 from trungleduc/skip-region-check
Browse files Browse the repository at this point in the history
Skip getting region if it is provided
  • Loading branch information
DenisaCG authored May 22, 2024
2 parents 558f874 + c0144d5 commit 3c3d34c
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/s3contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,24 @@ export class Drive implements Contents.IDrive {
* @param options - The options used to initialize the object.
*/
constructor(options: Drive.IOptions) {
const { config, name } = options;
this._serverSettings = ServerConnection.makeSettings();

this._s3Client = new S3Client(options.config ?? {});
this._name = options.name;
this._s3Client = new S3Client(config ?? {});
this._name = name;
this._baseUrl = URLExt.join(
(options.config?.endpoint as string) ?? 'https://s3.amazonaws.com/',
(config?.endpoint as string) ?? 'https://s3.amazonaws.com/',
this._name
);
this._provider = 'S3';

this.getRegion().then((region: string) => {
this._region = region!;
});
const region = config?.region;
if (typeof region === 'string') {
this._region = region;
} else {
const regionPromise = region ?? this.getRegion;
regionPromise().then((region: string) => {
this._region = region!;
});
}

this._registeredFileTypes = {};
}
Expand Down

0 comments on commit 3c3d34c

Please sign in to comment.