From 2242e8eef17bc2ca87869683081282211ad6bd3e Mon Sep 17 00:00:00 2001 From: boogiewoogie Date: Sun, 6 Jul 2025 14:32:32 +0200 Subject: [PATCH] add CONFIG_READONLY functionality --- src/util/util/Config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/util/Config.ts b/src/util/util/Config.ts index 2624a60a..3d72b899 100644 --- a/src/util/util/Config.ts +++ b/src/util/util/Config.ts @@ -95,7 +95,9 @@ const generatePairs = (obj: object | null, key = ""): ConfigEntity[] => { async function applyConfig(val: ConfigValue) { if (process.env.CONFIG_PATH) - await fs.writeFile(overridePath, JSON.stringify(val, null, 4)); + if (!process.env.CONFIG_READONLY) + await fs.writeFile(overridePath, JSON.stringify(val, null, 4)); + else console.log("[WARNING] JSON config file in use, and writing is disabled! Programmatic config changes will not be persisted, and your config will not get updated!"); else { const pairs = generatePairs(val); await Promise.all(pairs.map((pair) => pair.save()));