This repository was archived by the owner on Jul 26, 2022. It is now read-only.
File tree 3 files changed +16
-2
lines changed
3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -345,6 +345,8 @@ spec:
345
345
property : api-key
346
346
` ` `
347
347
348
+ If you use Vault Namespaces (a Vault Enterprise feature) you can set the namespace to interact with via the ` VAULT_NAMESPACE` environment variable.
349
+
348
350
If Vault uses a certificate issued by a self-signed CA you will need to provide that certificate :
349
351
350
352
` ` ` sh
Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ if (environment === 'development') {
17
17
}
18
18
19
19
const vaultEndpoint = process . env . VAULT_ADDR || 'http://127.0.0.1:8200'
20
+ // Grab the vault namespace from the environment
21
+ const vaultNamespace = process . env . VAULT_NAMESPACE || null
22
+
20
23
const pollerIntervalMilliseconds = process . env . POLLER_INTERVAL_MILLISECONDS
21
24
? Number ( process . env . POLLER_INTERVAL_MILLISECONDS ) : 10000
22
25
@@ -32,6 +35,7 @@ const customResourceManagerDisabled = 'DISABLE_CUSTOM_RESOURCE_MANAGER' in proce
32
35
33
36
module . exports = {
34
37
vaultEndpoint,
38
+ vaultNamespace,
35
39
environment,
36
40
pollerIntervalMilliseconds,
37
41
metricsPort,
Original file line number Diff line number Diff line change @@ -54,15 +54,23 @@ const systemManagerBackend = new SystemManagerBackend({
54
54
assumeRole : awsConfig . assumeRole ,
55
55
logger
56
56
} )
57
- const vaultClient = vault ( {
57
+ const vaultOptions = {
58
58
apiVersion : 'v1' ,
59
59
endpoint : envConfig . vaultEndpoint ,
60
60
requestOptions : {
61
61
// When running vault in HA mode, you must follow redirects on PUT/POST/DELETE
62
62
// See: https://github.com/kr1sp1n/node-vault/issues/23
63
63
followAllRedirects : true
64
64
}
65
- } )
65
+ }
66
+ // Include the Vault Namespace header if we have provided it as an env var.
67
+ // See: https://github.com/kr1sp1n/node-vault/pull/137#issuecomment-585309687
68
+ if ( envConfig . vaultNamespace ) {
69
+ vaultOptions . headers = {
70
+ 'X-VAULT-NAMESPACE' : envConfig . vaultNamespace
71
+ }
72
+ }
73
+ const vaultClient = vault ( vaultOptions )
66
74
const vaultBackend = new VaultBackend ( { client : vaultClient , logger } )
67
75
const azureKeyVaultBackend = new AzureKeyVaultBackend ( {
68
76
credential : azureConfig . azureKeyVault ( ) ,
You can’t perform that action at this time.
0 commit comments