From 59ae90804c2b8f232abf10502cf504f55109f4b4 Mon Sep 17 00:00:00 2001 From: Peter Karolyi Date: Thu, 10 Oct 2024 11:17:46 +0200 Subject: [PATCH] feat: add support for default AWS environment variables --- src/config/configuration.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/config/configuration.ts b/src/config/configuration.ts index 7d9ffc5..eafaed6 100644 --- a/src/config/configuration.ts +++ b/src/config/configuration.ts @@ -15,9 +15,13 @@ const configurationSchema = z STORAGE_PROVIDER: z.literal("s3"), S3_BUCKET: z.string(), S3_ACCESS_KEY_ID: z.string().optional(), + AWS_ACCESS_KEY_ID: z.string().optional(), S3_SECRET_ACCESS_KEY: z.string().optional(), + AWS_SECRET_ACCESS_KEY: z.string().optional(), S3_SESSION_TOKEN: z.string().optional(), + AWS_SESSION_TOKEN: z.string().optional(), S3_REGION: z.string().default("us-east-1"), + AWS_REGION: z.string().optional(), S3_FORCE_PATH_STYLE: z.enum(["true", "false"]).default("false"), S3_ENDPOINT: z.string().optional(), }), @@ -38,11 +42,12 @@ const configurationSchema = z provider: data.STORAGE_PROVIDER, bucket: data.S3_BUCKET, credentials: { - accessKeyId: data.S3_ACCESS_KEY_ID, - secretAccessKey: data.S3_SECRET_ACCESS_KEY, - sessionToken: data.S3_SESSION_TOKEN, + accessKeyId: data.AWS_ACCESS_KEY_ID ?? data.S3_ACCESS_KEY_ID, + secretAccessKey: + data.AWS_SECRET_ACCESS_KEY ?? data.S3_SECRET_ACCESS_KEY, + sessionToken: data.AWS_SESSION_TOKEN ?? data.S3_SESSION_TOKEN, }, - region: data.S3_REGION, + region: data.AWS_REGION ?? data.S3_REGION, forcePathStyle: data.S3_FORCE_PATH_STYLE === "true", endpoint: data.S3_ENDPOINT, };