MCPcopy Create free account
hub / github.com/codehamr/codehamr / ResolvedKey

Method ResolvedKey

internal/config/config.go:234–242  ·  view source on GitHub ↗

ResolvedKey returns the profile's key, expanding it against the process environment when the WHOLE key is a `${VAR}` reference (the advertised form; see the config.yaml header). Lets config.yaml carry `key: ${MY_KEY}` instead of a plaintext secret: the reference is what round-trips on Save, the expa

()

Source from the content-addressed store, hash-verified

232// like "pa$$word" become "paword", then 401 with no hint anywhere), and
233// ExpandEnv has no escape syntax to opt out. Use this at every site that
234// dials out or branches on "is this profile keyed".
235func (p *Profile) ResolvedKey() string {
236 key := p.Key
237 if name, ok := strings.CutPrefix(key, "${"); ok {
238 if name, ok = strings.CutSuffix(name, "}"); ok && isEnvName(name) {
239 return os.Getenv(name)
240 }
241 }
242 return key
243}
244
245// isEnvName reports whether s is a POSIX environment variable name

Callers 10

InitMethod · 0.80
reloadConfigFromDiskMethod · 0.80
confirmActiveMethod · 0.80
rebuildClientMethod · 0.80
printHamrpassStatusMethod · 0.80
mainFunction · 0.80

Calls 1

isEnvNameFunction · 0.85