MCPcopy Index your code
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// ExpandEnv has no escape syntax to opt out. Use this at every site that
233// dials out or branches on "is this profile keyed".
234func (p *Profile) ResolvedKey() string {
235 key := p.Key
236 if name, ok := strings.CutPrefix(key, "${"); ok {
237 if name, ok = strings.CutSuffix(name, "}"); ok && isEnvName(name) {
238 return os.Getenv(name)
239 }
240 }
241 return key
242}
243
244// isEnvName reports whether s is a POSIX environment variable name
245// ([A-Za-z_][A-Za-z0-9_]*), the only content ${...} expands.

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