From 7eda1136eab8c55ea2f34e6461db855fc850a899 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Mon, 29 Apr 2024 09:19:37 +0200 Subject: [PATCH] oidc: starting with new .json model files is not worth a log line --- src/oidc.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/oidc.js b/src/oidc.js index 9df902b0b..b2117ab90 100644 --- a/src/oidc.js +++ b/src/oidc.js @@ -148,14 +148,13 @@ function load(modelName) { if (DATA_STORE[modelName]) return; const filePath = path.join(paths.OIDC_STORE_DIR, `${modelName}.json`); - // debug(`load: model ${modelName} based on ${filePath}.`); + debug(`load: model ${modelName} based on ${filePath}.`); let data = {}; try { data = JSON.parse(fs.readFileSync(filePath), 'utf8'); } catch (e) { - if (e.code === 'ENOENT') debug(`load: failed to read ${filePath}, start with new one.`); - else debug(`load: failed to read ${filePath}, use in-memory. %o`, e); + if (e.code !== 'ENOENT') debug(`load: failed to read ${filePath}, use in-memory. %o`, e); } DATA_STORE[modelName] = data; @@ -167,12 +166,11 @@ function save(modelName) { if (!DATA_STORE[modelName]) return; const filePath = path.join(paths.OIDC_STORE_DIR, `${modelName}.json`); - // debug(`save: model ${modelName} to ${filePath}.`); try { fs.writeFileSync(filePath, JSON.stringify(DATA_STORE[modelName], null, 2), 'utf8'); } catch (e) { - debug(`save: failed to write ${filePath}`, e); + debug(`save: model ${modelName} failed to write ${filePath}`, e); } }