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

Function readReusableClientProxyToken

src/proxy/clientSettings.js:175–196  ·  view source on GitHub ↗
(opts = {})

Source from the content-addressed store, hash-verified

173}
174
175function readReusableClientProxyToken(opts = {}) {
176 const env = opts.env || process.env;
177 if (isDisabled(env)) return null;
178
179 const resolved = resolveClaudeSettingsFile(opts, env);
180 const file = resolved.file;
181 if (!file) return null;
182 const settings = readJsonFile(file);
183 const cfg = settings && settings.env;
184 if (!cfg || typeof cfg !== 'object') return null;
185
186 const baseUrl = normalizeUrl(cfg.ANTHROPIC_BASE_URL);
187 const token = typeof cfg.ANTHROPIC_AUTH_TOKEN === 'string'
188 ? cfg.ANTHROPIC_AUTH_TOKEN.trim()
189 : '';
190 if (!isValidReusableProxyToken(token)
191 || !isManagedProxyClientSettings(settings, cfg, opts)
192 || !isLoopbackProxyUrl(baseUrl)) {
193 return null;
194 }
195 return token;
196}
197
198function backupExistingFile(file) {
199 try {

Callers 1

startMethod · 0.85

Calls 7

isDisabledFunction · 0.85
normalizeUrlFunction · 0.85
readJsonFileFunction · 0.70
isLoopbackProxyUrlFunction · 0.70

Tested by

no test coverage detected