1
0

Added a couple helper admin scrtipt

Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
James Ketrenos 2022-02-03 16:06:41 -08:00
parent 357dccd130
commit 790317428c
2 changed files with 44 additions and 0 deletions

22
server/roll Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
ADMIN=$(jq -r .admin config/local.json)
if [[ "${ADMIN}" == "" ]]; then
echo "You need to set your { 'admin': 'secret' } in config/local.json"
exit 1
fi
id=$1
color=$2
if [[ "${id}" == "" ]] || [[ "${color}" == "" ]]; then
echo "Usage: roll GAME-ID (red|white|blue|orange)-DICE"
exit 1
fi
curl --noproxy '*' -s -L \
--request PUT \
--header "PRIVATE-TOKEN: ${ADMIN}" \
--header "Content-Type: application/json" \
http://localhost:8930/ketr.ketran/api/v1/games/${id}/roll/${color} |
jq -r .status

22
server/state Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
ADMIN=$(jq -r .admin config/local.json)
if [[ "${ADMIN}" == "" ]]; then
echo "You need to set your { 'admin': 'secret' } in config/local.json"
exit 1
fi
id=$1
state=$2
if [[ "${id}" == "" ]] || [[ "${state}" == "" ]]; then
echo "Usage: roll GAME-ID game-order"
exit 1
fi
curl --noproxy '*' -s -L \
--request PUT \
--header "PRIVATE-TOKEN: ${ADMIN}" \
--header "Content-Type: application/json" \
http://localhost:8930/ketr.ketran/api/v1/games/${id}/state/${state} |
jq -r .status