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

Fallback to default AWS credential chain #7952

Merged
merged 2 commits into from
Jul 30, 2023
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
5 changes: 5 additions & 0 deletions .changeset/silver-shirts-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': minor
---

Allow falling back to default AWS credential provider
11 changes: 7 additions & 4 deletions packages/core/src/lib/assets/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@ export function getS3AssetsEndpoint(storageConfig: StorageConfig & { kind: 's3'

function s3AssetsCommon(storageConfig: StorageConfig & { kind: 's3' }) {
const s3 = new S3({
credentials: {
accessKeyId: storageConfig.accessKeyId,
secretAccessKey: storageConfig.secretAccessKey,
},
credentials:
storageConfig.accessKeyId && storageConfig.secretAccessKey
? {
accessKeyId: storageConfig.accessKeyId,
secretAccessKey: storageConfig.secretAccessKey,
}
: undefined,
region: storageConfig.region,
endpoint: storageConfig.endpoint,
forcePathStyle: storageConfig.forcePathStyle,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/types/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export type StorageConfig = (
/** Your s3 instance's region */
region: string;
/** An access Key ID with write access to your S3 instance */
accessKeyId: string;
accessKeyId?: string;
/** The secret access key that gives permissions to your access Key Id */
secretAccessKey: string;
secretAccessKey?: string;
/** An endpoint to use - to be provided if you are not using AWS as your endpoint */
endpoint?: string;
/** If true, will force the 'old' S3 path style of putting bucket name at the start of the pathname of the URL */
Expand Down