MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / readCategoryConfig

Function readCategoryConfig

daemon/src/service/version_adapter.ts:5–18  ·  view source on GitHub ↗
(configCategory: string, callback: (config: any) => boolean)

Source from the content-addressed store, hash-verified

3import { t } from "i18next";
4
5function readCategoryConfig(configCategory: string, callback: (config: any) => boolean) {
6 const configPaths = StorageSubsystem.readDir(configCategory);
7 for (const configPath of configPaths) {
8 try {
9 const config = JSON.parse(StorageSubsystem.readFile(configPath));
10 if (callback(config)) {
11 logger.info(t("TXT_CODE_6b2a9cab"), configPath);
12 StorageSubsystem.writeFile(configPath, JSON.stringify(config, null, 4));
13 }
14 } catch (error: any) {
15 logger.error(t("TXT_CODE_fb75aba9"), error);
16 }
17 }
18}
19
20function refactorInstanceConfig(config: any) {
21 if (isNaN(config.passWordType)) config.passWordType = 0;

Callers 1

detectConfigFunction · 0.70

Calls 5

readDirMethod · 0.80
infoMethod · 0.80
errorMethod · 0.80
readFileMethod · 0.45
writeFileMethod · 0.45

Tested by

no test coverage detected