This commit is contained in:
Reilly MacKenzie-Cree 2025-06-09 20:38:54 +00:00 committed by GitHub
commit 5b9676cce0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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