Skip to content
This repository was archived by the owner on Jul 26, 2022. It is now read-only.

Commit 190e6db

Browse files
feat(core): adds support for nested key lookups (eg key: a.b.c to get nested value in json secret) (#592)
* adds lodash get function for nested keys lookup * removed semicolon * added hasIn for nested property check, use get to return nested property value
1 parent 74d4459 commit 190e6db

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/backends/kv-backend.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

33
const AbstractBackend = require('./abstract-backend')
4+
const { get, hasIn } = require('lodash')
45

56
/** Key Value backend class. */
67
class KVBackend extends AbstractBackend {
@@ -61,11 +62,11 @@ class KVBackend extends AbstractBackend {
6162
return
6263
}
6364

64-
if (!(property in parsedValue)) {
65+
if (!(hasIn(parsedValue, property))) {
6566
throw new Error(`Could not find property ${property} in ${key}`)
6667
}
6768

68-
value = parsedValue[property]
69+
value = get(parsedValue, property)
6970
}
7071

7172
if (isBinary) {

0 commit comments

Comments
 (0)