MCPcopy Create free account
hub / github.com/Autoanys/Autoanys / readConfig

Function readConfig

frontend/addNodeConfig.js:45–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43var configPath = path.join(__dirname, "src/components/SubfFlowCanva/nodeConfig.js");
44// Read the existing config file
45var readConfig = function () {
46 var data = fs.readFileSync(configPath, "utf-8");
47 var configMatch = data.match(/const nodeConfigInit = (.*);/s);
48 if (!configMatch)
49 throw new Error("Config not found in file");
50 var config = JSON.parse(configMatch[1]);
51 return config;
52};
53// Write the updated config file
54var writeConfig = function (config) {
55 var data = "// nodeConfig.js\n\nconst nodeConfigInit = ".concat(JSON.stringify(config, null, 2), ";\n\nexport default nodeConfigInit;\n");

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected