MCPcopy Create free account
hub / github.com/EvoMap/evolver / writeSettings

Function writeSettings

src/proxy/server/settings.js:32–48  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

30}
31
32function writeSettings(data) {
33 const dir = getSettingsDir();
34 const file = getSettingsFile();
35 if (!fs.existsSync(dir)) {
36 fs.mkdirSync(dir, { recursive: true });
37 }
38 const current = readSettings();
39 const merged = { ...current, ...data };
40 // NOTE(windows): mode 0o600 is silently ignored on Windows. The settings
41 // file (which may contain proxy credentials) will NOT be owner-read-only.
42 // Only Windows user-profile directory ACLs provide isolation. The chmodSync
43 // call below is also a no-op on Windows but is retained for Unix correctness.
44 fs.writeFileSync(file, JSON.stringify(merged, null, 2), { encoding: 'utf8', mode: 0o600 });
45 // mode: 0o600 only applies on creation; explicitly chmod to tighten pre-existing files
46 try { fs.chmodSync(file, 0o600); } catch { /* best-effort; no-op on Windows */ }
47 return merged;
48}
49
50function clearSettings(opts = {}) {
51 try {

Callers 4

startMethod · 0.85

Calls 3

getSettingsDirFunction · 0.85
getSettingsFileFunction · 0.85
readSettingsFunction · 0.85

Tested by

no test coverage detected