MCPcopy Create free account
hub / github.com/Noumena-Network/code / parseEnvVars

Function parseEnvVars

src/utils/envUtils.ts:104–122  ·  view source on GitHub ↗
(
  rawEnvArgs: string[] | undefined,
)

Source from the content-addressed store, hash-verified

102 * @returns Object with key-value pairs
103 */
104export function parseEnvVars(
105 rawEnvArgs: string[] | undefined,
106): Record<string, string> {
107 const parsedEnv: Record<string, string> = {}
108
109 // Parse individual env vars
110 if (rawEnvArgs) {
111 for (const envStr of rawEnvArgs) {
112 const [key, ...valueParts] = envStr.split('=')
113 if (!key || valueParts.length === 0) {
114 throw new Error(
115 `Invalid environment variable format: ${envStr}, environment variables should be added as: -e KEY1=value1 -e KEY2=value2`,
116 )
117 }
118 parsedEnv[key] = valueParts.join('=')
119 }
120 }
121 return parsedEnv
122}
123
124/**
125 * Get the AWS region with fallback to default

Callers 1

registerMcpAddCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected