add scope to the admin token

This commit is contained in:
Earl Warren 2023-03-26 19:02:06 +02:00
parent c63c206b24
commit ba6467a698
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -52,7 +52,7 @@ function setup() {
else else
wait_for docker exec --user 1000 forgejo forgejo admin user create --admin --username "$user" --password "$password" --email "$user@example.com" wait_for docker exec --user 1000 forgejo forgejo admin user create --admin --username "$user" --password "$password" --email "$user@example.com"
fi fi
docker exec --user 1000 forgejo forgejo admin user generate-access-token -u $user --raw > forgejo-token docker exec --user 1000 forgejo forgejo admin user generate-access-token -u $user --raw --scopes 'all,sudo' > forgejo-token
( echo -n 'Authorization: token ' ; cat forgejo-token ) > forgejo-header ( echo -n 'Authorization: token ' ; cat forgejo-token ) > forgejo-header
( echo "#!/bin/sh" ; echo 'curl -sS -H "Content-Type: application/json" -H @'$(pwd)/forgejo-header' "$@"' ) > forgejo-api && chmod +x forgejo-api ( echo "#!/bin/sh" ; echo 'curl -sS -H "Content-Type: application/json" -H @'$(pwd)/forgejo-header' "$@"' ) > forgejo-api && chmod +x forgejo-api
} }