MCPcopy
hub / github.com/perkeep/perkeep / SecretRingFile

Method SecretRingFile

pkg/client/config.go:370–391  ·  view source on GitHub ↗

SecretRingFile returns the filename to the user's GPG secret ring. The value comes from either the --secret-keyring flag, the CAMLI_SECRET_RING environment variable, the client config file's "identitySecretRing" value, or the operating system default location.

()

Source from the content-addressed store, hash-verified

368// CAMLI_SECRET_RING environment variable, the client config file's
369// "identitySecretRing" value, or the operating system default location.
370func (c *Client) SecretRingFile() string {
371 if osutil.HasSecretRingFlag() {
372 if secretRing, ok := osutil.ExplicitSecretRingFile(); ok {
373 return secretRing
374 }
375 }
376 if android.OnAndroid() {
377 panic("on android, so CAMLI_SECRET_RING should have been defined, or --secret-keyring used.")
378 }
379 if c.noExtConfig {
380 log.Print("client: noExtConfig set; cannot get secret ring file from config or env vars.")
381 return ""
382 }
383 if configDisabled {
384 panic("Need a secret ring, and config file disabled")
385 }
386 configOnce.Do(parseConfig)
387 if config.IdentitySecretRing == "" {
388 return osutil.SecretRingFile()
389 }
390 return config.IdentitySecretRing
391}
392
393func fileExists(name string) bool {
394 _, err := os.Stat(name)

Callers 2

buildSignerMethod · 0.95

Calls 4

HasSecretRingFlagFunction · 0.92
ExplicitSecretRingFileFunction · 0.92
OnAndroidFunction · 0.92
SecretRingFileFunction · 0.92

Tested by

no test coverage detected