to dev
going forward try to use the callback helper function when possible:
gridpane::callback::app \
"/site/site-update" \
"site_url=${active_site}" \
"server_ip=${serverIP}" \
"system_user=${username}" \
"ssl@true" \
"silent@true"
If you haven't got the gridpane.sh
lib sourced in, then there is the possibility to use the wrapper cli:
gp callback \
"/site/site-update" \
"site_url=${active_site}" \
"server_ip=${serverIP}" \
"system_user=${username}" \
"ssl@true" \
"silent@true"
That will load the main gp.sh
script though, so a bit heavy...
If you do need to use a curl directly, then it needs to be in this format:
curl \
-d '{ "site_url":"'${active_site}'", "server_ip":"'${serverIP}'", "system_user":"'${username}'", "silent": true }' \
-H "Content-Type: application/json" \
-X POST https://${GPURL}/api/site/site-update?${token_type}=${gridpanetoken}
If the lib/gridpane.sh
lib is sourced in then $token_type
can be set using the gridpane::setglobals
function - which sets most of the globals needed...
Otherwise, you will need to do it yourself in your script:
if [[ -f /root/gridpane.server.key ]]; then
readonly gridpane_token_path="/root/gridpane.server.key"
readonly token_type="server_key"
else
readonly gridpane_token_path="/root/gridpane.token"
readonly token_type="api_token"
fi
readonly gridpanetoken=$(awk '{print $1; exit}' "$gridpane_token_path")
It needs to be done this way going forward so we can progressively handle the changeover to isolated servers and their keys...