1
0
James Ketrenos 6a7902c32f Add clearGame if only one player in game
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
2022-06-29 09:06:57 -07:00

38 lines
750 B
Bash
Executable File

#!/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
shift
rule=$1
shift
params="${*}"
params="${params// /,}"
if [[ "${rule}" == "list" ]]; then
params=" "
fi
if [[ "${id}" == "" ]] || [[ "${rule}" == "" ]] || [[ "${params}" == "" ]]; then
cat << EOF
Usage: rules GAME-ID [(list)|(RULE KEY:VALUE [KEY:VALUE])]
Examples:
./rules test volcano enabled:true gold:true number:4
EOF
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}/rules/${rule}=${params}
# jq -r .status