feat: add administrators, require administrator perms to change server config in webui #628
@ -14,6 +14,13 @@ fs.watchFile(configPath, () => {
|
|||||||
amnesia = false;
|
amnesia = false;
|
||||||
} else {
|
} else {
|
||||||
logger.info("Detected a change to config.json, reloading its contents.");
|
logger.info("Detected a change to config.json, reloading its contents.");
|
||||||
|
|
||||||
|
// Set all values to undefined now so if the new config.json omits some fields that were previously present, it's correct in-memory.
|
||||||
|
for (const key of Object.keys(config)) {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
||||||
|
(config as any)[key] = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
Object.assign(config, JSON.parse(fs.readFileSync(configPath, "utf-8")));
|
Object.assign(config, JSON.parse(fs.readFileSync(configPath, "utf-8")));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user