Added /hosts/install?force=true to the api endpoint to force the installation of the agent if there are existing broken packages on the host you want to monito

This commit is contained in:
Muhammad Ibrahim
2025-10-04 13:09:29 +01:00
parent 766d36ff80
commit fa57b35270
3 changed files with 86 additions and 7 deletions

View File

@@ -1127,12 +1127,16 @@ router.get("/install", async (req, res) => {
}
} catch (_) {}
// Inject the API credentials, server URL, and curl flags into the script
// Check for --force parameter
const forceInstall = req.query.force === "true" || req.query.force === "1";
// Inject the API credentials, server URL, curl flags, and force flag into the script
const envVars = `#!/bin/bash
export PATCHMON_URL="${serverUrl}"
export API_ID="${host.api_id}"
export API_KEY="${host.api_key}"
export CURL_FLAGS="${curlFlags}"
export FORCE_INSTALL="${forceInstall ? "true" : "false"}"
`;