diff --git a/src/commands/infra.sh b/src/commands/infra.sh index b7b07de..ce55260 100644 --- a/src/commands/infra.sh +++ b/src/commands/infra.sh @@ -21,6 +21,21 @@ wx-infra(){ fi fi + if [[ ! -f "$INFRA_PATH/vault/cwchristerw" || ! -f "$INFRA_PATH/vault/warengroup" ]] + then + mkdir -p "$INFRA_PATH/vault" &> /dev/null + + curl \ + -H "X-Vault-Token: ${config["login",$ORG]}" \ + -X GET \ + https://$VAULT_DOMAIN/v1/cli/data/cwchristerw/settings/infra -s | jq -r '.data.data.cwchristerw' > "$INFRA_PATH/vault/cwchristerw" + + curl \ + -H "X-Vault-Token: ${config["login",$ORG]}" \ + -X GET \ + https://$VAULT_DOMAIN/v1/cli/data/cwchristerw/settings/infra -s | jq -r '.data.data.warenroup' > "$INFRA_PATH/vault/warengroup" + fi + if [[ -z $1 ]] then echo "Tag Required" diff --git a/wx b/wx index c195db6..9f178d0 100755 --- a/wx +++ b/wx @@ -154,6 +154,21 @@ wx-infra(){ fi fi + if [[ ! -f "$INFRA_PATH/vault/cwchristerw" || ! -f "$INFRA_PATH/vault/warengroup" ]] + then + mkdir -p "$INFRA_PATH/vault" &> /dev/null + + curl \ + -H "X-Vault-Token: ${config["login",$ORG]}" \ + -X GET \ + https://$VAULT_DOMAIN/v1/cli/data/cwchristerw/settings/infra -s | jq -r '.data.data.cwchristerw' > "$INFRA_PATH/vault/cwchristerw" + + curl \ + -H "X-Vault-Token: ${config["login",$ORG]}" \ + -X GET \ + https://$VAULT_DOMAIN/v1/cli/data/cwchristerw/settings/infra -s | jq -r '.data.data.warenroup' > "$INFRA_PATH/vault/warengroup" + fi + if [[ -z $1 ]] then echo "Tag Required"