Open plocket opened 1 year ago
Confirming that you mean get_dev_id
, and that it would just be changed for is_server_responding
, right? https://github.com/SuffolkLITLab/ALKiln/blob/f6237b510eca937afba7d0fe858646bcaf007246/lib/docassemble/docassemble_api_interface.js#L137
Slight suggestion to use server_url.com/health_status?ready=1
instead, which is already in JSON. It'll look something like this:
{
"ok": true,
"server_start_time": 1696040337.5918229,
"version": "1.4.67"
}
Yes and sounds good 👍
Note: We still need get_dev_id()
for the playground interview url address and we might add some setup code for playground installs to specifically check that they have given the right API key so we don't go through (potentially) reloading the server and everything before then discovering the API key is invalid.
Moving on, the code would look similar to this, just with health_status
:
// node -e 'require("./lib/docassemble/docassemble_api_REST.js").health_check()'
da.health_check = async function ( timeout ) {
try {
return await axios.get(
`${ session_vars.get_da_server_url() }/health_check?ready=1`,
{ timeout }
);
} catch ( error ) {
let response = error.response || { data: null }
throw { ...error.toJSON(), data: response.data };
}
}; // Ends da.health_check()
Use a
server_url.com/health_check?ready=1
type of thing instead of makingget_user_id()
do double duty. That API call isn't really designed for that anyway.