diff --git a/giteaDo b/giteaDo index ee92ac9..73b8923 100755 --- a/giteaDo +++ b/giteaDo @@ -1,5 +1,9 @@ #!/bin/sh +GITEA_URL="http://git.konsthol.eu:3333" + +USERNAME="konsthol" + NAME="${0##*/}" function usage() { @@ -25,7 +29,7 @@ EOF function createRepo() { curl -X POST \ -"http://git.konsthol.eu:3333/api/v1/user/repos?access_token=$(pass SelfHosted/giteaTokenForKonsthol | awk -F\" '{print $10}')" \ +"$GITEA_URL/api/v1/user/repos?access_token=$(pass SelfHosted/giteaTokenForKonsthol | awk -F\" '{print $10}')" \ -H "accept:application/json" \ -H "Content-Type: application/json" \ -d "{ @@ -44,7 +48,7 @@ curl -X POST \ function deleteRepo() { curl -X DELETE \ -"http://git.konsthol.eu:3333/api/v1/repos/konsthol/$1?access_token=$(pass SelfHosted/giteaTokenForKonsthol | awk -F\" '{print $10}')" \ +"$GITEA_URL/api/v1/repos/$USERNAME/$1?access_token=$(pass SelfHosted/giteaTokenForKonsthol | awk -F\" '{print $10}')" \ -H "accept:application/json" } @@ -52,7 +56,7 @@ curl -X DELETE \ function listRepos { RESPONSE=$(curl -s -X GET \ -"http://git.konsthol.eu:3333/api/v1/users/konsthol/repos?access_token=$(pass SelfHosted/giteaTokenForKonsthol | awk -F\" '{print $10}')" \ +"$GITEA_URL/api/v1/users/$USERNAME/repos?access_token=$(pass SelfHosted/giteaTokenForKonsthol | awk -F\" '{print $10}')" \ -H "accept:application/json" \ -H "Content-Type: application/json" \ -d "{ @@ -60,7 +64,7 @@ RESPONSE=$(curl -s -X GET \ \"limit\": \"5\" }") -echo "$RESPONSE" | jq | grep "full_name\": \"konsthol" | awk -F/ '{print $2}' | sed 's/"//g' | sed 's/,//g' +echo "$RESPONSE" | jq | grep "full_name\": \"$USERNAME" | awk -F/ '{print $2}' | sed 's/"//g' | sed 's/,//g' }