@@ -43,7 +43,10 @@ export const buildStoreProvider: StorageProviderBuilder = (config: StaticPublish
4343 return new S3StorageProvider (
4444 s3StorageConfig . region ,
4545 s3StorageConfig . bucket ,
46- s3StorageConfig . endpoint ,
46+ {
47+ s3Endpoint : s3StorageConfig . endpoint ,
48+ s3FastlyBackendName : s3StorageConfig . fastlyBackendName ,
49+ } ,
4750 ) ;
4851} ;
4952
@@ -93,27 +96,35 @@ export function setAwsCredentialsBuilder(awsCredentialsBuilder: AwsCredentialsBu
9396 _awsCredentialsBuilder = awsCredentialsBuilder ;
9497}
9598
99+ export type S3StorageProviderParams = {
100+ s3Endpoint ?: string ,
101+ s3FastlyBackendName ?: string ,
102+ } ;
103+
96104export class S3StorageProvider implements StorageProvider {
97105 constructor (
98106 s3Region : string ,
99107 s3Bucket : string ,
100- s3Endpoint ?: string ,
108+ params ?: S3StorageProviderParams ,
101109 ) {
102110 this . s3Region = s3Region ;
103111 this . s3Bucket = s3Bucket ;
104- this . s3Endpoint = s3Endpoint ;
112+ this . s3Endpoint = params ?. s3Endpoint ;
113+ this . s3FastlyBackendName = params ?. s3FastlyBackendName ;
105114 }
106115
107116 private readonly s3Region : string ;
108117 private readonly s3Bucket : string ;
109118 private readonly s3Endpoint ?: string ;
119+ private readonly s3FastlyBackendName ?: string ;
110120
111121 private s3Client ?: S3Client ;
112122 async getS3Client ( ) {
113123 if ( this . s3Client != null ) {
114124 return this . s3Client ;
115125 }
116126 const awsCredentials = await _awsCredentialsBuilder ( ) ;
127+ const s3FastlyBackendName = this . s3FastlyBackendName ?? "aws" ;
117128 this . s3Client = new S3Client ( {
118129 region : this . s3Region ,
119130 endpoint : this . s3Endpoint ,
@@ -124,7 +135,7 @@ export class S3StorageProvider implements StorageProvider {
124135 } ,
125136 maxAttempts : 1 ,
126137 requestHandler : new FetchHttpHandler ( {
127- requestInit ( ) { return { backend : "aws" } }
138+ requestInit ( ) { return { backend : s3FastlyBackendName } }
128139 } ) ,
129140 } ) ;
130141 return this . s3Client ;
0 commit comments