Skip to content

Commit

Permalink
feat: add support for default AWS environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
pkarolyi committed Oct 10, 2024
1 parent 3e130a6 commit 59ae908
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/config/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand All @@ -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,
};
Expand Down

0 comments on commit 59ae908

Please sign in to comment.