Reduce output of config validation errors

This commit is contained in:
shamoon
2026-06-02 20:59:58 -07:00
parent 91f3b9df5c
commit cbb5667512
4 changed files with 41 additions and 12 deletions
+12 -2
View File
@@ -1,9 +1,19 @@
import checkAndCopyConfig from "utils/config/config";
import createLogger from "utils/logger";
const configs = ["docker.yaml", "settings.yaml", "services.yaml", "bookmarks.yaml", "kubernetes.yaml", "proxmox.yaml"];
const logger = createLogger("configValidationHandler");
export default async function handler(req, res) {
const errors = configs.map((config) => checkAndCopyConfig(config)).filter((status) => status !== true);
let errors = configs.map((config) => checkAndCopyConfig(config)).filter((status) => status !== true);
if (errors.length > 0) {
logger.error("Configuration validation errors", errors);
errors = errors.map((error) => ({
name: error.name,
config: error.config,
reason: error.reason,
mark: { line: error.mark?.line },
}));
}
res.send(errors);
}