Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "codex.docs",
"license": "Apache-2.0",
"version": "2.3.2",
"version": "2.3.3",
"type": "module",
"bin": {
"codex.docs": "dist/backend/app.js"
Expand Down
12 changes: 9 additions & 3 deletions src/backend/uploads/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import mime from 'mime';
import multer from 'multer';
import { S3UploadsConfig } from '../utils/appConfig.js';
import { FileData } from '../models/file.js';
import { PutObjectCommand, S3Client } from '@aws-sdk/client-s3';
import { PutObjectCommand, S3Client, S3ClientConfig } from '@aws-sdk/client-s3';
import fileType from 'file-type';

/**
Expand All @@ -30,13 +30,19 @@ export default class S3UploadsDriver implements UploadsDriver {
*/
constructor(config: S3UploadsConfig) {
this.config = config;
this.s3Client = new S3Client({
const clientConfig: S3ClientConfig = {
region: this.config.s3.region,
credentials: {
accessKeyId: this.config.s3.accessKeyId,
secretAccessKey: this.config.s3.secretAccessKey,
},
});
};

if (this.config.s3.endpoint) {
clientConfig.endpoint = this.config.s3.endpoint;
}

this.s3Client = new S3Client(clientConfig);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/backend/utils/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const S3UploadsConfig = z.object({
keyPrefix: z.string(),
accessKeyId: z.string(),
secretAccessKey: z.string(),
endpoint: z.string().optional(),
}),
});

Expand Down
Loading