File tree Expand file tree Collapse file tree 5 files changed +28
-7
lines changed
Expand file tree Collapse file tree 5 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,26 @@ OpenFeature.setProvider(
3030 })
3131);
3232```
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+
3353## Retrieve Feature Flag!
3454
3555Create 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 {
2222 cache : Cache ;
2323
2424 constructor ( config : AwsSsmProviderConfig ) {
25- this . service = new SSMService ( config . ssmClientConfig ) ;
25+ this . service = new SSMService ( config . ssmClientConfig , config . enableDecryption ) ;
2626 this . cache = new Cache ( config . cacheOpts ) ;
2727 }
2828
Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ export class Cache {
88 private enabled : boolean ;
99 constructor ( opts : LRUCacheConfig ) {
1010 this . cache = new LRUCache ( {
11- maxSize : opts . size ,
11+ maxSize : opts . size ?? 1000 ,
1212 sizeCalculation : ( ) => 1 ,
1313 } ) ;
14- this . ttl = opts . ttl ;
14+ this . ttl = opts . ttl ?? 300000 ;
1515 this . enabled = opts . enabled ;
1616 }
1717
Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ import {
1818export class SSMService {
1919 client : SSMClient ;
2020 enableDecryption : boolean ;
21- constructor ( config : SSMClientConfig , enableDecryption : boolean = false ) {
21+ constructor ( config : SSMClientConfig , enableDecryption ? : boolean ) {
2222 this . client = new SSMClient ( config ) ;
23- this . enableDecryption = enableDecryption ;
23+ this . enableDecryption = enableDecryption ?? false ;
2424 }
2525
2626 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';
33export type AwsSsmProviderConfig = {
44 ssmClientConfig : SSMClientConfig ;
55 cacheOpts : LRUCacheConfig ;
6+ enableDecryption ?: boolean ;
67} ;
78
89export type LRUCacheConfig = {
910 enabled : boolean ;
10- ttl : number ;
11- size : number ;
11+ ttl ? : number ;
12+ size ? : number ;
1213} ;
You can’t perform that action at this time.
0 commit comments