Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: better S3 flexibility #2379

Merged
merged 2 commits into from
Jan 16, 2025
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
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,10 @@ AWS_SECRET_ACCESS_KEY=
AWS_REGION=
AWS_S3_BUCKET=
AWS_S3_UPLOAD_PATH=
AWS_S3_ENDPOINT=
AWS_S3_SSL_ENABLED=
AWS_S3_FORCE_PATH_STYLE=


# Deepgram
DEEPGRAM_API_KEY=
Expand Down
3 changes: 3 additions & 0 deletions packages/plugin-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_REGION=your_aws_region
AWS_S3_BUCKET=your_s3_bucket
AWS_S3_UPLOAD_PATH=your_upload_path
AWS_S3_ENDPOINT=an_alternative_endpoint
AWS_S3_SSL_ENABLED=boolean(true|false)
AWS_S3_FORCE_PATH_STYLE=boolean(true|false)
```

## Usage
Expand Down
10 changes: 10 additions & 0 deletions packages/plugin-node/src/services/awsS3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,17 @@ export class AwsS3Service extends Service implements IAwsS3Service {
return false;
}

/** Optional fields to allow for other providers */
const endpoint = this.runtime.getSetting("AWS_S3_ENDPOINT");
const sslEnabled = this.runtime.getSetting("AWS_S3_SSL_ENABLED");
const forcePathStyle = this.runtime.getSetting("AWS_S3_FORCE_PATH_STYLE");

this.s3Client = new S3Client({
...(endpoint ? { endpoint } : {}),
...(sslEnabled ? { sslEnabled } : {}),
...(forcePathStyle
? { forcePathStyle: Boolean(forcePathStyle) }
: {}),
region: AWS_REGION,
credentials: {
accessKeyId: AWS_ACCESS_KEY_ID,
Expand Down
Loading