feat: support dual stack endpoint configuration option

This commit is contained in:
reillymc 2025-06-09 20:07:16 +00:00
parent 82a47babb7
commit 02069ba82c

View file

@ -26,6 +26,7 @@ type Config = {
secretAccessKey?: string
endpoint?: string
forcePathStyle?: boolean
useDualstackEndpoint?: boolean
acl?: string
}
@ -38,6 +39,7 @@ class S3Storage extends StorageBase {
pathPrefix: string
endpoint: string
forcePathStyle: boolean
useDualstackEndpoint: boolean
acl?: ObjectCannedACL
constructor(config: Config = {}) {
@ -52,6 +54,7 @@ class S3Storage extends StorageBase {
secretAccessKey,
endpoint,
forcePathStyle,
useDualstackEndpoint,
acl,
} = config
@ -70,6 +73,11 @@ class S3Storage extends StorageBase {
Boolean(forcePathStyle) ||
false
this.useDualstackEndpoint =
Boolean(process.env.GHOST_STORAGE_ADAPTER_S3_USE_DUALSTACK_ENDPOINT) ||
Boolean(useDualstackEndpoint) ||
false
let defaultHost: string
if (this.forcePathStyle) {
@ -129,6 +137,7 @@ class S3Storage extends StorageBase {
const options: S3ClientConfig = {
region: this.region,
forcePathStyle: this.forcePathStyle,
useDualstackEndpoint: this.useDualstackEndpoint,
}
// Set credentials only if provided, falls back to AWS SDK's default provider chain