MCPcopy
hub / github.com/dosco/graphjin / expandEnv

Function expandEnv

core/openapi/loader.go:137–142  ·  view source on GitHub ↗

expandEnv replaces ${VAR} placeholders with their environment values. Missing variables expand to empty string — we don't fail the whole load on a single missing credential because operations without credentials should still appear in the registry (they'll just fail at call time).

(s string)

Source from the content-addressed store, hash-verified

135// on a single missing credential because operations without credentials
136// should still appear in the registry (they'll just fail at call time).
137func expandEnv(s string) string {
138 return envVarPattern.ReplaceAllStringFunc(s, func(match string) string {
139 name := match[2 : len(match)-1]
140 return os.Getenv(name)
141 })
142}
143
144// canonicaliseOpKeys rewrites user-supplied Joins/Operations map keys
145// to match the spec's actual operationId casing. Viper lowercases all

Callers 3

expandSpecConfigFunction · 0.85
expandAuthConfigFunction · 0.85
TestExpandEnvFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestExpandEnvFunction · 0.68