fix(core): update

This commit is contained in:
2024-06-10 00:15:01 +02:00
parent 054585c7f5
commit 2e7e8ae5cf
8 changed files with 104 additions and 31 deletions

View File

@@ -28,6 +28,7 @@ export class DockerHost {
public socketPath: string;
private registryToken: string = '';
public imageStore: DockerImageStore;
public smartBucket: plugins.smartbucket.SmartBucket;
/**
* the constructor to instantiate a new docker sock instance
@@ -274,4 +275,21 @@ export class DockerHost {
console.log(response.body);
return response;
}
/**
* add s3 storage
* @param optionsArg
*/
public async addS3Storage(optionsArg: plugins.tsclass.storage.IS3Descriptor) {
this.smartBucket = new plugins.smartbucket.SmartBucket(optionsArg);
if (!optionsArg.bucketName) {
throw new Error('bucketName is required');
}
const bucket = await this.smartBucket.getBucketByName(optionsArg.bucketName);
let wantedDirectory = await bucket.getBaseDirectory();
if (optionsArg.directoryPath) {
wantedDirectory = await wantedDirectory.getSubDirectoryByName(optionsArg.directoryPath);
}
this.imageStore.options.bucketDir = wantedDirectory;
}
}