Skip to content

Commit dda5feb

Browse files
authored
Merge pull request #2379 from JoeyKhd/s3-improvement
feat: better S3 flexibility
2 parents 1000dd6 + 162f114 commit dda5feb

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

.env.example

+4
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,10 @@ AWS_SECRET_ACCESS_KEY=
550550
AWS_REGION=
551551
AWS_S3_BUCKET=
552552
AWS_S3_UPLOAD_PATH=
553+
AWS_S3_ENDPOINT=
554+
AWS_S3_SSL_ENABLED=
555+
AWS_S3_FORCE_PATH_STYLE=
556+
553557

554558
# Deepgram
555559
DEEPGRAM_API_KEY=

packages/plugin-node/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ AWS_SECRET_ACCESS_KEY=your_aws_secret_key
5454
AWS_REGION=your_aws_region
5555
AWS_S3_BUCKET=your_s3_bucket
5656
AWS_S3_UPLOAD_PATH=your_upload_path
57+
AWS_S3_ENDPOINT=an_alternative_endpoint
58+
AWS_S3_SSL_ENABLED=boolean(true|false)
59+
AWS_S3_FORCE_PATH_STYLE=boolean(true|false)
5760
```
5861

5962
## Usage

packages/plugin-node/src/services/awsS3.ts

+10
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,17 @@ export class AwsS3Service extends Service implements IAwsS3Service {
5858
return false;
5959
}
6060

61+
/** Optional fields to allow for other providers */
62+
const endpoint = this.runtime.getSetting("AWS_S3_ENDPOINT");
63+
const sslEnabled = this.runtime.getSetting("AWS_S3_SSL_ENABLED");
64+
const forcePathStyle = this.runtime.getSetting("AWS_S3_FORCE_PATH_STYLE");
65+
6166
this.s3Client = new S3Client({
67+
...(endpoint ? { endpoint } : {}),
68+
...(sslEnabled ? { sslEnabled } : {}),
69+
...(forcePathStyle
70+
? { forcePathStyle: Boolean(forcePathStyle) }
71+
: {}),
6272
region: AWS_REGION,
6373
credentials: {
6474
accessKeyId: AWS_ACCESS_KEY_ID,

0 commit comments

Comments
 (0)