fixed syntax healthcheck
This commit is contained in:
@@ -10,7 +10,14 @@ healthRouter.get('/', async (_req, res) => {
|
|||||||
const missing = missingEnvVars();
|
const missing = missingEnvVars();
|
||||||
const checks = {
|
const checks = {
|
||||||
config: checkValue(!missing.length, missing.length ? `missing: ${missing.join(', ')}` : 'ok'),
|
config: checkValue(!missing.length, missing.length ? `missing: ${missing.join(', ')}` : 'ok'),
|
||||||
commands: await checkCommands(['incus', 'zfs', 'zpool', 'restic', 'udevadm', 'dd']),
|
commands: await checkCommands({
|
||||||
|
incus: ['version'],
|
||||||
|
zfs: ['version'],
|
||||||
|
zpool: ['version'],
|
||||||
|
restic: ['version'],
|
||||||
|
udevadm: ['--version'],
|
||||||
|
dd: ['--version'],
|
||||||
|
}),
|
||||||
zfsPool: await checkZfsPool(),
|
zfsPool: await checkZfsPool(),
|
||||||
zvol: await checkZvolAccess(),
|
zvol: await checkZvolAccess(),
|
||||||
resticRepository: await checkResticRepository(),
|
resticRepository: await checkResticRepository(),
|
||||||
@@ -22,8 +29,8 @@ healthRouter.get('/', async (_req, res) => {
|
|||||||
|
|
||||||
async function checkCommands(commands) {
|
async function checkCommands(commands) {
|
||||||
const results = {};
|
const results = {};
|
||||||
await Promise.all(commands.map(async (command) => {
|
await Promise.all(Object.entries(commands).map(async ([command, args]) => {
|
||||||
results[command] = await checkCommand(command, ['--version']);
|
results[command] = await checkCommand(command, args);
|
||||||
}));
|
}));
|
||||||
const failed = Object.entries(results).filter(([, result]) => !result.ok);
|
const failed = Object.entries(results).filter(([, result]) => !result.ok);
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user