@@ -43,7 +43,10 @@ export const buildStoreProvider: StorageProviderBuilder = (config: StaticPublish
43
43
return new S3StorageProvider (
44
44
s3StorageConfig . region ,
45
45
s3StorageConfig . bucket ,
46
- s3StorageConfig . endpoint ,
46
+ {
47
+ s3Endpoint : s3StorageConfig . endpoint ,
48
+ s3FastlyBackendName : s3StorageConfig . fastlyBackendName ,
49
+ } ,
47
50
) ;
48
51
} ;
49
52
@@ -93,27 +96,35 @@ export function setAwsCredentialsBuilder(awsCredentialsBuilder: AwsCredentialsBu
93
96
_awsCredentialsBuilder = awsCredentialsBuilder ;
94
97
}
95
98
99
+ export type S3StorageProviderParams = {
100
+ s3Endpoint ?: string ,
101
+ s3FastlyBackendName ?: string ,
102
+ } ;
103
+
96
104
export class S3StorageProvider implements StorageProvider {
97
105
constructor (
98
106
s3Region : string ,
99
107
s3Bucket : string ,
100
- s3Endpoint ?: string ,
108
+ params ?: S3StorageProviderParams ,
101
109
) {
102
110
this . s3Region = s3Region ;
103
111
this . s3Bucket = s3Bucket ;
104
- this . s3Endpoint = s3Endpoint ;
112
+ this . s3Endpoint = params ?. s3Endpoint ;
113
+ this . s3FastlyBackendName = params ?. s3FastlyBackendName ;
105
114
}
106
115
107
116
private readonly s3Region : string ;
108
117
private readonly s3Bucket : string ;
109
118
private readonly s3Endpoint ?: string ;
119
+ private readonly s3FastlyBackendName ?: string ;
110
120
111
121
private s3Client ?: S3Client ;
112
122
async getS3Client ( ) {
113
123
if ( this . s3Client != null ) {
114
124
return this . s3Client ;
115
125
}
116
126
const awsCredentials = await _awsCredentialsBuilder ( ) ;
127
+ const s3FastlyBackendName = this . s3FastlyBackendName ?? "aws" ;
117
128
this . s3Client = new S3Client ( {
118
129
region : this . s3Region ,
119
130
endpoint : this . s3Endpoint ,
@@ -124,7 +135,7 @@ export class S3StorageProvider implements StorageProvider {
124
135
} ,
125
136
maxAttempts : 1 ,
126
137
requestHandler : new FetchHttpHandler ( {
127
- requestInit ( ) { return { backend : "aws" } }
138
+ requestInit ( ) { return { backend : s3FastlyBackendName } }
128
139
} ) ,
129
140
} ) ;
130
141
return this . s3Client ;
0 commit comments