MCPcopy Create free account
hub / github.com/openclaw/gogcli / ResolveKeyringBackendInfoWithOptions

Function ResolveKeyringBackendInfoWithOptions

internal/secrets/backend.go:90–111  ·  view source on GitHub ↗
(options OpenOptions)

Source from the content-addressed store, hash-verified

88}
89
90func ResolveKeyringBackendInfoWithOptions(options OpenOptions) (KeyringBackendInfo, error) {
91 if v := normalizeKeyringBackend(options.Backend); v != "" {
92 return KeyringBackendInfo{Value: v, Source: keyringBackendSourceEnv}, nil
93 }
94
95 if options.Config == nil {
96 return KeyringBackendInfo{}, errNilConfigStore
97 }
98
99 cfg, err := options.Config.Read()
100 if err != nil {
101 return KeyringBackendInfo{}, fmt.Errorf("resolve keyring backend: %w", err)
102 }
103
104 if cfg.KeyringBackend != "" {
105 if v := normalizeKeyringBackend(cfg.KeyringBackend); v != "" {
106 return KeyringBackendInfo{Value: v, Source: keyringBackendSourceConfig}, nil
107 }
108 }
109
110 return KeyringBackendInfo{Value: keyringBackendAuto, Source: keyringBackendSourceDefault}, nil
111}
112
113func allowedBackends(info KeyringBackendInfo) ([]keyring.BackendType, error) {
114 switch info.Value {

Calls 3

normalizeKeyringBackendFunction · 0.85
ErrorfMethod · 0.80
ReadMethod · 0.45