mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Spread s3 config
Fixes https://gitlab.com/soapbox-pub/ditto/-/issues/156
This commit is contained in:
parent
c39fd2daa2
commit
c3af8299f1
2 changed files with 17 additions and 4 deletions
|
|
@ -98,10 +98,10 @@ class Conf {
|
|||
/** S3 media storage configuration. */
|
||||
static s3 = {
|
||||
get endPoint(): string | undefined {
|
||||
return Deno.env.get('S3_ENDPOINT')!;
|
||||
return Deno.env.get('S3_ENDPOINT');
|
||||
},
|
||||
get region(): string | undefined {
|
||||
return Deno.env.get('S3_REGION')!;
|
||||
return Deno.env.get('S3_REGION');
|
||||
},
|
||||
get accessKey(): string | undefined {
|
||||
return Deno.env.get('S3_ACCESS_KEY');
|
||||
|
|
@ -145,7 +145,7 @@ class Conf {
|
|||
return Deno.env.get('DITTO_UPLOADER');
|
||||
}
|
||||
/** Location to use for local uploads. */
|
||||
static get uploadsDir(): string | undefined {
|
||||
static get uploadsDir(): string {
|
||||
return Deno.env.get('UPLOADS_DIR') || 'data/uploads';
|
||||
}
|
||||
/** Media base URL for uploads. */
|
||||
|
|
|
|||
|
|
@ -13,7 +13,20 @@ export const uploaderMiddleware: AppMiddleware = async (c, next) => {
|
|||
|
||||
switch (Conf.uploader) {
|
||||
case 's3':
|
||||
c.set('uploader', new S3Uploader(Conf.s3));
|
||||
c.set(
|
||||
'uploader',
|
||||
new S3Uploader({
|
||||
accessKey: Conf.s3.accessKey,
|
||||
bucket: Conf.s3.bucket,
|
||||
endPoint: Conf.s3.endPoint!,
|
||||
pathStyle: Conf.s3.pathStyle,
|
||||
port: Conf.s3.port,
|
||||
region: Conf.s3.region!,
|
||||
secretKey: Conf.s3.secretKey,
|
||||
sessionToken: Conf.s3.sessionToken,
|
||||
useSSL: Conf.s3.useSSL,
|
||||
}),
|
||||
);
|
||||
break;
|
||||
case 'ipfs':
|
||||
c.set('uploader', new IPFSUploader({ baseUrl: Conf.mediaDomain, apiUrl: Conf.ipfs.apiUrl, fetch: fetchWorker }));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue