Skip to content

Commit 181c7d3

Browse files
committed
Adding get_vault_kv function
1 parent 5b254e3 commit 181c7d3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.envrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ if has vault; then
1414
TOKEN_RENEW=$(vault token-renew -format=json 2>/dev/null)
1515
else
1616
# authenticate
17-
vault auth -method=github
17+
vault login -method=github
1818
fi
1919
fi
2020
fi
2121

22+
function get_vault_kv {
23+
vault_path=$1
24+
if [[ "$VAULT_ADDR" ]]; then
25+
VAULT_KV=$(curl -s -H "X-Vault-Token: $(cat ~/.vault-token )" -X GET $VAULT_ADDR/v1/${vault_path} | jq -r .data.value)
26+
fi
27+
}
28+
2229
# vim: set et fenc=utf-8 ff=unix ft=sh sts=2 sw=2 ts=2 :

0 commit comments

Comments
 (0)