| 11 | let implName; |
| 12 | |
| 13 | function getVaultClient(config) { |
| 14 | const { host, port } = config.vaultd; |
| 15 | let vaultClient; |
| 16 | |
| 17 | if (config.https) { |
| 18 | const { key, cert, ca } = config.https; |
| 19 | logger.info('vaultclient configuration', { |
| 20 | host, |
| 21 | port, |
| 22 | https: true, |
| 23 | }); |
| 24 | vaultClient = new vaultclient.Client(host, port, true, key, cert, ca); |
| 25 | } else { |
| 26 | logger.info('vaultclient configuration', { |
| 27 | host, |
| 28 | port, |
| 29 | https: false, |
| 30 | }); |
| 31 | vaultClient = new vaultclient.Client(host, port); |
| 32 | } |
| 33 | |
| 34 | if (config.log) { |
| 35 | vaultClient.setLoggerConfig({ |
| 36 | level: config.log.logLevel, |
| 37 | dump: config.log.dumpLevel, |
| 38 | }); |
| 39 | } |
| 40 | |
| 41 | return vaultClient; |
| 42 | } |
| 43 | |
| 44 | function getMemBackend(config) { |
| 45 | config.on('authdata-update', () => { |