MCPcopy
hub / github.com/MagicMirrorOrg/MagicMirror / getConfig

Function getConfig

js/server.js:115–129  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

113 const getStartup = (req, res) => res.send(startUp);
114
115 const getConfig = (req, res) => {
116 const obj = config.hideConfigSecrets ? configObj.redactedConf : configObj.fullConf;
117 // Functions can't survive JSON.stringify, so we wrap them in a
118 // tagged object { __mmFunction: "<source>" }. The client-side
119 // JSON reviver in main.js recognises this tag and reconstructs
120 // the live function from the source string.
121 const jsonString = JSON.stringify(obj, (key, value) => {
122 if (typeof value === "function") {
123 return { __mmFunction: value.toString() };
124 }
125 return value;
126 });
127 res.set("Content-Type", "application/json");
128 res.send(jsonString);
129 };
130
131 app.get("/config", (req, res) => getConfig(req, res));
132

Callers 1

ServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected