docker.js and services.js: async'ify

This commit is contained in:
Girish Ramakrishnan
2021-08-25 19:41:46 -07:00
parent 1cc11fece8
commit 42774eac8c
24 changed files with 1618 additions and 2130 deletions

View File

@@ -163,20 +163,18 @@ async function getConfig(req, res, next) {
next(new HttpSuccess(200, cloudronConfig));
}
function getDisks(req, res, next) {
system.getDisks(function (error, result) {
if (error) return next(BoxError.toHttpError(error));
async function getDisks(req, res, next) {
const [error, result] = await safe(system.getDisks());
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, result));
});
next(new HttpSuccess(200, result));
}
function getMemory(req, res, next) {
system.getMemory(function (error, result) {
if (error) return next(BoxError.toHttpError(error));
async function getMemory(req, res, next) {
const [error, result] = await safe(system.getMemory());
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, result));
});
next(new HttpSuccess(200, result));
}
function update(req, res, next) {