MCPcopy
hub / github.com/dgraph-io/dgraph / vaultGetKvStore

Function vaultGetKvStore

x/vault.go:100–117  ·  view source on GitHub ↗

vaultGetKvStore fetches a KV store from located at path.

(client *api.Client, path string)

Source from the content-addressed store, hash-verified

98
99// vaultGetKvStore fetches a KV store from located at path.
100func vaultGetKvStore(client *api.Client, path string) (vaultKvStore, error) {
101 secret, err := client.Logical().Read(path)
102 if err != nil {
103 return nil, fmt.Errorf("vault: error retrieving path %s: %s", path, err)
104 }
105 if secret == nil || secret.Data == nil {
106 return nil, fmt.Errorf("vault: error retrieving path %s: empty response", path)
107 }
108
109 var kv vaultKvStore
110 kv, ok := secret.Data["data"].(map[string]interface{})
111 if !ok {
112 glog.Infof("vault: failed to parse response in KV V2 format, falling back to V1")
113 kv = secret.Data
114 }
115
116 return kv, nil
117}
118
119// getSensitiveBytes retrieves a value from a kvStore, decoding it if necessary.
120func (kv vaultKvStore) getSensitiveBytes(field, format string) (Sensitive, error) {

Callers 1

vaultGetKeysFunction · 0.85

Calls 3

InfofMethod · 0.80
ReadMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected