From 802fe0f721b641f09effab272ebd287979e89f65 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 11 Oct 2022 08:13:19 -0700 Subject: [PATCH] Glances widget use settings for URL --- src/pages/api/widgets/glances.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pages/api/widgets/glances.js b/src/pages/api/widgets/glances.js index b02028600..d8cc04b7a 100644 --- a/src/pages/api/widgets/glances.js +++ b/src/pages/api/widgets/glances.js @@ -1,12 +1,19 @@ import { httpProxy } from "utils/proxy/http"; import createLogger from "utils/logger"; +import { getSettings } from "utils/config/config"; const logger = createLogger("glances"); export default async function handler(req, res) { - const { url } = req.query; + const settings = getSettings()?.glances; + if (!settings) { + logger.error("There is no glances section in settings.yaml"); + return res.status(400).json({ error: "There is no glances section in settings.yaml" }); + } + const url = settings?.url; if (!url) { + logger.error("Missing Glances URL"); return res.status(400).json({ error: "Missing Glances URL" }); }