35 lines
688 B
Bash
Executable File
35 lines
688 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 [[ "${id}" == "" ]] || [[ "${rule}" == "" ]] || [[ "${params}" == "" ]]; then
|
|
cat << EOF
|
|
Usage: rules GAME-ID 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
|
|
|
|
|