File tree 2 files changed +13
-8
lines changed
2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,9 @@ export type BasicAuthConfiguration = { type: 'basic' } & (
18
18
export type AuthConfiguration = { type : 'none' } | BasicAuthConfiguration ;
19
19
20
20
export interface S3StoreConfiguration {
21
- accessKey : string ;
22
- secretKey : string ;
21
+ detectCredentials : boolean ;
22
+ accessKey ?: string ;
23
+ secretKey ?: string ;
23
24
bucket : string ;
24
25
endpoint : string ;
25
26
region : string ;
@@ -96,16 +97,17 @@ export function loadConfig() {
96
97
}
97
98
// for now, this works
98
99
{
100
+ store . detectCredentials ??= true ;
99
101
store . accessKey = getEnv < string > (
100
102
'STORE_ACCESS_KEY' ,
101
103
store . accessKey ,
102
- ! store . accessKey
103
- ) . toString ( ) ;
104
+ ! store . detectCredentials
105
+ ) ? .toString ( ) ;
104
106
store . secretKey = getEnv < string > (
105
107
'STORE_SECRET_KEY' ,
106
108
store . secretKey ,
107
- ! store . secretKey
108
- ) . toString ( ) ;
109
+ ! store . detectCredentials
110
+ ) ? .toString ( ) ;
109
111
store . bucket = getEnv < string > (
110
112
'STORE_BUCKET' ,
111
113
store . bucket ?? 'notea' ,
Original file line number Diff line number Diff line change @@ -40,11 +40,14 @@ export class StoreS3 extends StoreProvider {
40
40
forcePathStyle : config . pathStyle ,
41
41
region : config . region ,
42
42
endpoint : config . endPoint ,
43
- credentials : {
43
+ credentials : ( ( config . accessKey && config . secretKey ) ? {
44
44
accessKeyId : config . accessKey ,
45
45
secretAccessKey : config . secretKey ,
46
- } ,
46
+ } : undefined ) ,
47
47
} ) ;
48
+ if ( ! config . accessKey || ! config . secretKey ) {
49
+ console . log ( '[Notea] Environment variables STORE_ACCESS_KEY or STORE_SECRET_KEY is missing. Trying to use IAM role credentials instead ...' ) ;
50
+ }
48
51
this . config = config ;
49
52
}
50
53
You can’t perform that action at this time.
0 commit comments