File tree Expand file tree Collapse file tree 4 files changed +15
-14
lines changed
schemaregistry/rules/encryption Expand file tree Collapse file tree 4 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -9,10 +9,6 @@ export class HcVaultClient implements KmsClient {
99 private keyName : string
1010
1111 constructor ( keyUri : string , namespace ?: string , token ?: string ) {
12- if ( token == null )
13- {
14- namespace = process . env [ "VAULT_NAMESPACE" ]
15- }
1612 if ( ! keyUri . startsWith ( HcVaultDriver . PREFIX ) ) {
1713 throw new Error ( `key uri must start with ${ HcVaultDriver . PREFIX } ` )
1814 }
Original file line number Diff line number Diff line change @@ -20,8 +20,13 @@ export class HcVaultDriver implements KmsDriver {
2020
2121 newKmsClient ( config : Map < string , string > , keyUrl ?: string ) : KmsClient {
2222 const uriPrefix = keyUrl != null ? keyUrl : HcVaultDriver . PREFIX
23- const tokenId = config . get ( HcVaultDriver . TOKEN_ID )
24- const ns = config . get ( HcVaultDriver . NAMESPACE )
23+ let tokenId = config . get ( HcVaultDriver . TOKEN_ID )
24+ let ns = config . get ( HcVaultDriver . NAMESPACE )
25+ if ( tokenId == null )
26+ {
27+ tokenId = process . env [ "VAULT_TOKEN" ]
28+ ns = process . env [ "VAULT_NAMESPACE" ]
29+ }
2530 return new HcVaultClient ( uriPrefix , ns , tokenId )
2631 }
2732}
Original file line number Diff line number Diff line change @@ -10,13 +10,7 @@ export class LocalKmsClient implements KmsClient {
1010 private secret : string
1111 private cryptor : Cryptor
1212
13- constructor ( secret ?: string ) {
14- if ( secret == null ) {
15- secret = process . env [ 'LOCAL_SECRET' ]
16- }
17- if ( secret == null ) {
18- throw new Error ( 'cannot load secret' )
19- }
13+ constructor ( secret : string ) {
2014 this . secret = secret
2115 this . cryptor = new Cryptor ( DekFormat . AES128_GCM )
2216 }
Original file line number Diff line number Diff line change @@ -18,7 +18,13 @@ export class LocalKmsDriver implements KmsDriver {
1818 }
1919
2020 newKmsClient ( config : Map < string , string > , keyUrl : string ) : KmsClient {
21- const secret = config . get ( LocalKmsDriver . SECRET )
21+ let secret = config . get ( LocalKmsDriver . SECRET )
22+ if ( secret == null ) {
23+ secret = process . env [ 'LOCAL_SECRET' ]
24+ }
25+ if ( secret == null ) {
26+ throw new Error ( 'cannot load secret' )
27+ }
2228 return new LocalKmsClient ( secret )
2329 }
2430}
You can’t perform that action at this time.
0 commit comments