🛠️New configuration variable for S3 home directory (#359)
This commit is contained in:
@@ -89,6 +89,7 @@
|
|||||||
"path": "STORAGE_LOCAL_PATH"
|
"path": "STORAGE_LOCAL_PATH"
|
||||||
},
|
},
|
||||||
"S3": {
|
"S3": {
|
||||||
|
"homeDirectory": "STORAGE_S3_HOME_DIRECTORY",
|
||||||
"bucket": "STORAGE_S3_BUCKET",
|
"bucket": "STORAGE_S3_BUCKET",
|
||||||
"region": "STORAGE_S3_REGION",
|
"region": "STORAGE_S3_REGION",
|
||||||
"endPoint": "STORAGE_S3_ENDPOINT",
|
"endPoint": "STORAGE_S3_ENDPOINT",
|
||||||
|
|||||||
@@ -38,7 +38,14 @@ export default class StorageService extends TdriveService<StorageAPI> implements
|
|||||||
const type = this.getConnectorType();
|
const type = this.getConnectorType();
|
||||||
if (type === "S3") {
|
if (type === "S3") {
|
||||||
logger.info("Using 'S3' connector for storage.");
|
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({
|
return new S3ConnectorService({
|
||||||
bucket: this.configuration.get<string>("S3.bucket"),
|
bucket: this.configuration.get<string>("S3.bucket"),
|
||||||
region: this.configuration.get<string>("S3.region"),
|
region: this.configuration.get<string>("S3.region"),
|
||||||
|
|||||||
Reference in New Issue
Block a user