mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-11 16:53:08 +02:00
23 lines
658 B
TypeScript
23 lines
658 B
TypeScript
|
import * as Bull from 'bull';
|
||
|
import * as Minio from 'minio';
|
||
|
import { fetchMeta } from '../../../misc/fetch-meta';
|
||
|
|
||
|
export default async (job: Bull.Job) => {
|
||
|
const meta = await fetchMeta();
|
||
|
|
||
|
const minio = new Minio.Client({
|
||
|
endPoint: meta.objectStorageEndpoint!,
|
||
|
region: meta.objectStorageRegion ? meta.objectStorageRegion : undefined,
|
||
|
port: meta.objectStoragePort ? meta.objectStoragePort : undefined,
|
||
|
useSSL: meta.objectStorageUseSSL,
|
||
|
accessKey: meta.objectStorageAccessKey!,
|
||
|
secretKey: meta.objectStorageSecretKey!,
|
||
|
});
|
||
|
|
||
|
const key: string = job.data.key;
|
||
|
|
||
|
await minio.removeObject(meta.objectStorageBucket!, key);
|
||
|
|
||
|
return 'Success';
|
||
|
};
|