CLI: Update

This commit is contained in:
Christer Warén
2026-09-28 22:54:57 +03:00
parent 36b9e55b7e
commit 64e3f00917
+7 -7
View File
@@ -129,19 +129,19 @@ wxi-config-legacy(){
login) login)
case $2 in case $2 in
write) write)
jq '.login.'$ORG'.token = "'$TOKEN'"' $HOME/.warengroup/config.json &> $HOME/.warengroup/config.json.tmp jq '.login.'$ORG'.token = "'$TOKEN'"' $WX_HOME/config.json &> $WX_HOME/config.json.tmp
;; ;;
read) read)
if [[ -f "$HOME/.warengroup/config.json" && $(cat $HOME/.warengroup/config.json | jq -r .login.$ORG.token) != 'null' && $(cat $HOME/.warengroup/config.json | jq -r .login.$ORG.token) != '' ]] if [[ -f "$WX_HOME/config.json" && $(cat$WX_HOME/config.json | jq -r .login.$ORG.token) != 'null' && $(cat $WX_HOME/config.json | jq -r .login.$ORG.token) != '' ]]
then then
cat $HOME/.warengroup/config.json | jq -r .login.$ORG.token cat $WX_HOME/config.json | jq -r .login.$ORG.token
else else
return 1 return 1
fi fi
;; ;;
erase) erase)
TOKEN="" TOKEN=""
wxi-config login write wxi-config-legacy login write
;; ;;
esac esac
;; ;;
@@ -150,7 +150,7 @@ wxi-config-legacy(){
;; ;;
esac esac
mv $HOME/.warengroup/config.json.tmp $HOME/.warengroup/config.json &> /dev/null mv $WX_HOME/config.json.tmp $WX_HOME/config.json &> /dev/null
} }
wxi-restricted(){ wxi-restricted(){
@@ -670,9 +670,9 @@ wx-logout(){
wxi-restricted --org wxi-restricted --org
wxi-restricted --vault wxi-restricted --vault
if [[ -f "$HOME/.warengroup/config.json" && $(cat $HOME/.warengroup/config.json | jq -r .login.$ORG.token) != 'null' ]] if [[ -f "$WX_HOME/config.json" && $(cat $WX_HOME/config.json | jq -r .login.$ORG.token) != 'null' ]]
then then
TOKEN=$(cat $HOME/.warengroup/config.json | jq -r .login.$ORG.token) TOKEN=$(cat $WX_HOME/config.json | jq -r .login.$ORG.token)
fi fi
VAULT_STATUS=$(curl https://$VAULT_DOMAIN/v1/auth/token/revoke-self -X POST --header "X-Vault-Token: $TOKEN" -s -o /dev/null -w "%{http_code}") VAULT_STATUS=$(curl https://$VAULT_DOMAIN/v1/auth/token/revoke-self -X POST --header "X-Vault-Token: $TOKEN" -s -o /dev/null -w "%{http_code}")