Add route to list all blockdevices

This commit is contained in:
Johannes Zellner
2023-01-23 17:56:01 +01:00
parent 3dcd4f9da3
commit a6fdb96fbf
4 changed files with 51 additions and 2 deletions

View File

@@ -27,7 +27,8 @@ exports = module.exports = {
syncExternalLdap,
syncDnsRecords,
getSystemGraphs,
getPlatformStatus
getPlatformStatus,
getBlockDevices
};
const assert = require('assert'),
@@ -365,3 +366,10 @@ async function getSystemGraphs(req, res, next) {
async function getPlatformStatus(req, res, next) {
next(new HttpSuccess(200, platform.getStatus()));
}
async function getBlockDevices(req, res, next) {
const [error, devices] = await safe(cloudron.getBlockDevices());
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(200, { devices }));
}