mirror of
https://github.com/laosb/ghos3.git
synced 2025-07-23 10:42:40 +00:00
feat: support dual stack endpoint configuration option
This commit is contained in:
parent
82a47babb7
commit
02069ba82c
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue