From af50852815ceaf7ca4f1b4a8dffca5d961a2f812 Mon Sep 17 00:00:00 2001 From: jj Date: Sun, 27 Oct 2024 18:00:05 +0000 Subject: [PATCH] api/api-keys: log message to confirm successful file load --- api/src/security/api-keys.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/api/src/security/api-keys.js b/api/src/security/api-keys.js index 72063099..bbb00194 100644 --- a/api/src/security/api-keys.js +++ b/api/src/security/api-keys.js @@ -1,6 +1,6 @@ import { env } from "../config.js"; import { readFile } from "node:fs/promises"; -import { Yellow } from "../misc/console-text.js"; +import { Green, Yellow } from "../misc/console-text.js"; import ip from "ipaddr.js"; // this function is a modified variation of code @@ -134,9 +134,13 @@ const loadKeys = async (source) => { keys = formatKeys(updated); } -const wrapLoad = (url) => { +const wrapLoad = (url, initial = false) => { loadKeys(url) - .then(() => {}) + .then(() => { + if (initial) { + console.log(`${Green('[✓]')} api keys loaded successfully!`) + } + }) .catch((e) => { console.error(`${Yellow('[!]')} Failed loading API keys at ${new Date().toISOString()}.`); console.error('Error:', e); @@ -200,7 +204,7 @@ export const validateAuthorization = (req) => { } export const setup = (url) => { - wrapLoad(url); + wrapLoad(url, true); if (env.keyReloadInterval > 0) { setInterval(() => wrapLoad(url), env.keyReloadInterval * 1000); }