Source Update
This commit is contained in:
parent
963770b974
commit
6619193dc6
@ -91,6 +91,28 @@ wx-login(){
|
||||
VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/sys/health)
|
||||
if [[ $VAULT_STATUS -eq 200 ]]
|
||||
then
|
||||
if [[ -f "$HOME/.config/warengroup/login.json" ]]
|
||||
then
|
||||
TOKEN="$(cat $HOME/.config/warengroup/login.json | jq -r .$ORG)"
|
||||
fi
|
||||
|
||||
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token')
|
||||
if [[ ! -z $VAULT_LOGIN && ${#VAULT_LOGIN} == 95 ]]
|
||||
then
|
||||
echo -n $wxBold
|
||||
echo -n $ORG
|
||||
echo $wxNormal
|
||||
|
||||
echo -n "Username: "
|
||||
echo -n $wxItalic
|
||||
echo -n $(curl https://$VAULT_DOMAIN/v1/auth/token/lookup-self -X GET --header "X-Vault-Token: $VAULT_LOGIN" -s | jq -r '.data.meta.username')
|
||||
echo $wxNormal
|
||||
|
||||
config[${ORG}]=$VAULT_LOGIN
|
||||
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||
|
||||
wx-start
|
||||
else
|
||||
IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$IDM_DOMAIN)
|
||||
if [[ $IDM_STATUS -eq 301 ]]
|
||||
then
|
||||
@ -140,6 +162,12 @@ wx-login(){
|
||||
fi
|
||||
|
||||
config[${ORG}]=$VAULT_LOGIN
|
||||
|
||||
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||
touch $HOME/.config/warengroup/login.json &> /dev/null
|
||||
|
||||
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||
|
||||
wx-start
|
||||
else
|
||||
echo -n $wxBold
|
||||
@ -172,8 +200,15 @@ wx-login(){
|
||||
fi
|
||||
|
||||
config[${ORG}]=$VAULT_LOGIN
|
||||
|
||||
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||
touch $HOME/.config/warengroup/login.json &> /dev/null
|
||||
|
||||
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||
|
||||
wx-start
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo -n $wxBold
|
||||
echo -n $ORG
|
||||
|
35
wx
35
wx
@ -113,6 +113,28 @@ wx-login(){
|
||||
VAULT_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$VAULT_DOMAIN/v1/sys/health)
|
||||
if [[ $VAULT_STATUS -eq 200 ]]
|
||||
then
|
||||
if [[ -f "$HOME/.config/warengroup/login.json" ]]
|
||||
then
|
||||
TOKEN="$(cat $HOME/.config/warengroup/login.json | jq -r .$ORG)"
|
||||
fi
|
||||
|
||||
VAULT_LOGIN=$(curl https://$VAULT_DOMAIN/v1/auth/token/renew -X POST --header "X-Vault-Token: $TOKEN" -d '{ "token": "'$TOKEN'" }' -s | jq -r '.auth.client_token')
|
||||
if [[ ! -z $VAULT_LOGIN && ${#VAULT_LOGIN} == 95 ]]
|
||||
then
|
||||
echo -n $wxBold
|
||||
echo -n $ORG
|
||||
echo $wxNormal
|
||||
|
||||
echo -n "Username: "
|
||||
echo -n $wxItalic
|
||||
echo -n $(curl https://$VAULT_DOMAIN/v1/auth/token/lookup-self -X GET --header "X-Vault-Token: $VAULT_LOGIN" -s | jq -r '.data.meta.username')
|
||||
echo $wxNormal
|
||||
|
||||
config[${ORG}]=$VAULT_LOGIN
|
||||
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||
|
||||
wx-start
|
||||
else
|
||||
IDM_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://$IDM_DOMAIN)
|
||||
if [[ $IDM_STATUS -eq 301 ]]
|
||||
then
|
||||
@ -162,6 +184,12 @@ wx-login(){
|
||||
fi
|
||||
|
||||
config[${ORG}]=$VAULT_LOGIN
|
||||
|
||||
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||
touch $HOME/.config/warengroup/login.json &> /dev/null
|
||||
|
||||
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||
|
||||
wx-start
|
||||
else
|
||||
echo -n $wxBold
|
||||
@ -194,8 +222,15 @@ wx-login(){
|
||||
fi
|
||||
|
||||
config[${ORG}]=$VAULT_LOGIN
|
||||
|
||||
mkdir -p $HOME/.config/warengroup &> /dev/null
|
||||
touch $HOME/.config/warengroup/login.json &> /dev/null
|
||||
|
||||
echo '{ "'$ORG'": "'$VAULT_LOGIN'" }' | jq > $HOME/.config/warengroup/login.json
|
||||
|
||||
wx-start
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo -n $wxBold
|
||||
echo -n $ORG
|
||||
|
Loading…
Reference in New Issue
Block a user