diff --git a/src/index.ts b/src/index.ts index 85f88bd..8636653 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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