diff --git a/tdrive/backend/node/config/custom-environment-variables.json b/tdrive/backend/node/config/custom-environment-variables.json index b13282be..c0b736bd 100644 --- a/tdrive/backend/node/config/custom-environment-variables.json +++ b/tdrive/backend/node/config/custom-environment-variables.json @@ -89,6 +89,7 @@ "path": "STORAGE_LOCAL_PATH" }, "S3": { + "homeDirectory": "STORAGE_S3_HOME_DIRECTORY", "bucket": "STORAGE_S3_BUCKET", "region": "STORAGE_S3_REGION", "endPoint": "STORAGE_S3_ENDPOINT", 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 cacda65f..e03e69fb 100644 --- a/tdrive/backend/node/src/core/platform/services/storage/index.ts +++ b/tdrive/backend/node/src/core/platform/services/storage/index.ts @@ -38,7 +38,14 @@ export default class StorageService extends TdriveService implements const type = this.getConnectorType(); if (type === "S3") { logger.info("Using 'S3' connector for storage."); - this.homeDir = this.configuration.get("S3.bucket"); + try { + this.homeDir = this.configuration.get("S3.homeDirectory"); + } catch (e) { + this.logger.warn("Home directory is not set, using S3.bucket instead"); + } + if (!this.homeDir) { + this.homeDir = this.configuration.get("S3.bucket"); + } return new S3ConnectorService({ bucket: this.configuration.get("S3.bucket"), region: this.configuration.get("S3.region"),