🛠️New configuration variable for S3 home directory (#359)

This commit is contained in:
Anton Shepilov
2024-02-06 13:44:21 +01:00
committed by GitHub
parent a6ced0d615
commit df0809ec48
2 changed files with 9 additions and 1 deletions
@@ -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",
@@ -38,7 +38,14 @@ export default class StorageService extends TdriveService<StorageAPI> implements
const type = this.getConnectorType();
if (type === "S3") {
logger.info("Using 'S3' connector for storage.");
this.homeDir = this.configuration.get<string>("S3.bucket");
try {
this.homeDir = this.configuration.get<string>("S3.homeDirectory");
} catch (e) {
this.logger.warn("Home directory is not set, using S3.bucket instead");
}
if (!this.homeDir) {
this.homeDir = this.configuration.get<string>("S3.bucket");
}
return new S3ConnectorService({
bucket: this.configuration.get<string>("S3.bucket"),
region: this.configuration.get<string>("S3.region"),