MCPcopy Index your code
hub / github.com/simstudioai/sim / getEffectiveDecryptedEnv

Function getEffectiveDecryptedEnv

apps/sim/lib/environment/utils.ts:363–390  ·  view source on GitHub ↗
(
  userId: string,
  workspaceId?: string
)

Source from the content-addressed store, hash-verified

361 * Returns a merged decrypted env map for webhook/copilot/MCP config resolution.
362 */
363export async function getEffectiveDecryptedEnv(
364 userId: string,
365 workspaceId?: string
366): Promise<Record<string, string>> {
367 const cacheKey = getEffectiveDecryptedEnvCacheKey(userId, workspaceId)
368 const cached = effectiveDecryptedEnvCache.get(cacheKey)
369 if (cached) {
370 return cloneEnvVars(await cached.promise)
371 }
372
373 const promise = getPersonalAndWorkspaceEnv(userId, workspaceId)
374 .then(({ personalDecrypted, workspaceDecrypted }) => ({
375 ...personalDecrypted,
376 ...workspaceDecrypted,
377 }))
378 .catch((error) => {
379 effectiveDecryptedEnvCache.delete(cacheKey)
380 throw error
381 })
382
383 effectiveDecryptedEnvCache.set(cacheKey, {
384 userId,
385 workspaceId,
386 promise,
387 })
388
389 return cloneEnvVars(await promise)
390}

Callers 6

prepareExecutionContextFunction · 0.90
buildExecutionContextFunction · 0.90
resolveMcpConfigEnvVarsFunction · 0.90
resolveEnvVarsInObjectFunction · 0.90
verifyProviderAuthFunction · 0.90

Calls 6

cloneEnvVarsFunction · 0.85
getMethod · 0.65
deleteMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected