From 12d7f1b3e65ca2cd7c9ef881e336aeea61084d42 Mon Sep 17 00:00:00 2001 From: Gandalf Date: Thu, 12 Jan 2023 13:05:37 +0100 Subject: [PATCH] copy TOKEN* to SIP* variables at the right moment fix #1 --- authorization.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/authorization.sh b/authorization.sh index 4f31de7..fead4d4 100755 --- a/authorization.sh +++ b/authorization.sh @@ -1,5 +1,13 @@ BASEPATH=$(dirname $(realpath $0)) . $BASEPATH/.env + +if [ $TOKENID ] && [ -z $SIPUSER ] +then SIPUSER=$TOKENID +fi +if [ $TOKEN ] && [ -z $SIPPWD ] +then SIPPWD=$TOKEN +fi + AUTH_TOKEN=$(curl -o /dev/null -s -w "%{http_code}\n" --request GET --header 'Accept: application/json' --user $SIPUSER:$SIPPWD https://api.sipgate.com/v2/authorization/userinfo -s) if [ $AUTH_TOKEN = "200" ]; then