diff --git a/tdrive/backend/node/src/core/platform/framework/configuration.ts b/tdrive/backend/node/src/core/platform/framework/configuration.ts index 50fc4c3d..a32b52dd 100644 --- a/tdrive/backend/node/src/core/platform/framework/configuration.ts +++ b/tdrive/backend/node/src/core/platform/framework/configuration.ts @@ -21,7 +21,7 @@ export class Configuration implements TdriveServiceConfiguration { if (name) { value = this.serviceConfiguration && - (this.serviceConfiguration.get(name) || configuration.get(name)); + (this.serviceConfiguration.get(name) || configuration.get(name)); } } catch { value = defaultValue || null; diff --git a/tdrive/backend/node/src/core/platform/services/storage/connectors/S3/service.ts b/tdrive/backend/node/src/core/platform/services/storage/connectors/S3/service.ts index a5bac237..8659ceb7 100644 --- a/tdrive/backend/node/src/core/platform/services/storage/connectors/S3/service.ts +++ b/tdrive/backend/node/src/core/platform/services/storage/connectors/S3/service.ts @@ -3,14 +3,22 @@ import { logger } from "../../../../../../core/platform/framework"; import { Readable } from "stream"; import { StorageConnectorAPI, WriteMetadata } from "../../provider"; -export type S3Configuration = Minio.ClientOptions & { bucket: string }; +export type S3Configuration = { + bucket: string; + region: string; + endPoint: string; + port: number; + useSSL: boolean; + accessKey: string; + secretKey: string; +}; export default class S3ConnectorService implements StorageConnectorAPI { client: Minio.Client; minioConfiguration: S3Configuration; constructor(S3Configuration: S3Configuration) { - this.client = new Minio.Client({ ...S3Configuration }); + this.client = new Minio.Client(S3Configuration); this.minioConfiguration = S3Configuration; } diff --git a/tdrive/backend/node/src/core/platform/services/storage/index.ts b/tdrive/backend/node/src/core/platform/services/storage/index.ts index b421000a..b3829e1d 100644 --- a/tdrive/backend/node/src/core/platform/services/storage/index.ts +++ b/tdrive/backend/node/src/core/platform/services/storage/index.ts @@ -3,7 +3,7 @@ import { Stream, Readable } from "stream"; import Multistream from "multistream"; import { Consumes, logger, TdriveService } from "../../framework"; import LocalConnectorService, { LocalConfiguration } from "./connectors/local/service"; -import S3ConnectorService, { S3Configuration } from "./connectors/S3/service"; +import S3ConnectorService from "./connectors/S3/service"; import StorageAPI, { DeleteOptions, ReadOptions, @@ -37,7 +37,15 @@ export default class StorageService extends TdriveService implements const type = this.getConnectorType(); if (type === "S3") { logger.info("Using 'S3' connector for storage."); - return new S3ConnectorService(this.configuration.get("S3")); + return new S3ConnectorService({ + bucket: this.configuration.get("S3.bucket"), + region: this.configuration.get("S3.region"), + endPoint: this.configuration.get("S3.endPoint"), + port: Number(this.configuration.get("S3.port")), + useSSL: Boolean(this.configuration.get("S3.useSSL")), + accessKey: this.configuration.get("S3.accessKey"), + secretKey: this.configuration.get("S3.secretKey"), + }); } logger.info( `Using 'local' connector for storage${