File tree 5 files changed +28
-7
lines changed
5 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,26 @@ OpenFeature.setProvider(
30
30
})
31
31
);
32
32
```
33
+
34
+ # AWS SSM Provider Configuration
35
+
36
+ ## AwsSsmProviderConfig
37
+
38
+ | Property | Type | Description | Default |
39
+ | -----------------| --------------------| ----------------------------------------------| ---------|
40
+ | ` ssmClientConfig ` | ` SSMClientConfig ` | AWS SSM Client configuration options. | See [ here] ( https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ssm/ ) |
41
+ | ` enableDecryption ` | ` boolean ` | Enable decryption for SecureString parameters | false |
42
+ | ` cacheOpts ` | ` LRUCacheConfig ` | Configuration for the local LRU cache. | See below |
43
+
44
+ ## LRUCacheConfig
45
+
46
+ | Property | Type | Description | Default |
47
+ | -----------| --------| ------------------------------------------------| ---------|
48
+ | ` enabled ` | ` boolean ` | Whether caching is enabled. | ` true ` |
49
+ | ` ttl ` | ` number ` | Time-to-live (TTL) for cached items (in ms). | ` 300000 ` (5 minutes) |
50
+ | ` size ` | ` number ` | Maximum number of items in the cache. | ` 1000 ` |
51
+
52
+
33
53
## Retrieve Feature Flag!
34
54
35
55
Create a new SSM Param called 'my-feature-flag' in your AWS Account and then retrieve it via OpenFeature Client!
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export class AwsSsmProvider implements Provider {
22
22
cache : Cache ;
23
23
24
24
constructor ( config : AwsSsmProviderConfig ) {
25
- this . service = new SSMService ( config . ssmClientConfig ) ;
25
+ this . service = new SSMService ( config . ssmClientConfig , config . enableDecryption ) ;
26
26
this . cache = new Cache ( config . cacheOpts ) ;
27
27
}
28
28
Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ export class Cache {
8
8
private enabled : boolean ;
9
9
constructor ( opts : LRUCacheConfig ) {
10
10
this . cache = new LRUCache ( {
11
- maxSize : opts . size ,
11
+ maxSize : opts . size ?? 1000 ,
12
12
sizeCalculation : ( ) => 1 ,
13
13
} ) ;
14
- this . ttl = opts . ttl ;
14
+ this . ttl = opts . ttl ?? 300000 ;
15
15
this . enabled = opts . enabled ;
16
16
}
17
17
Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ import {
18
18
export class SSMService {
19
19
client : SSMClient ;
20
20
enableDecryption : boolean ;
21
- constructor ( config : SSMClientConfig , enableDecryption : boolean = false ) {
21
+ constructor ( config : SSMClientConfig , enableDecryption ? : boolean ) {
22
22
this . client = new SSMClient ( config ) ;
23
- this . enableDecryption = enableDecryption ;
23
+ this . enableDecryption = enableDecryption ?? false ;
24
24
}
25
25
26
26
async getBooleanValue ( name : string ) : Promise < ResolutionDetails < boolean > > {
Original file line number Diff line number Diff line change @@ -3,10 +3,11 @@ import { SSMClientConfig } from '@aws-sdk/client-ssm';
3
3
export type AwsSsmProviderConfig = {
4
4
ssmClientConfig : SSMClientConfig ;
5
5
cacheOpts : LRUCacheConfig ;
6
+ enableDecryption ?: boolean ;
6
7
} ;
7
8
8
9
export type LRUCacheConfig = {
9
10
enabled : boolean ;
10
- ttl : number ;
11
- size : number ;
11
+ ttl ? : number ;
12
+ size ? : number ;
12
13
} ;
You can’t perform that action at this time.
0 commit comments