Skip to content

Commit

Permalink
BE-594/keyring | Read from file backend when multiple backends are
Browse files Browse the repository at this point in the history
available

Fixes issue where when multiple backends are available on the system.
On such systems keyring attempts to read credentials from first available
backend which may be not file backend. At the moment we are using only
file backend for test keyring.
  • Loading branch information
deividaspetraitis committed Oct 15, 2024
1 parent e9a5865 commit fb0bdcb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions domain/keyring/osmosis_keyring.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ func New() (*keyringImpl, error) {
}

keyringConfig := keyring.Config{
AllowedBackends: []keyring.BackendType{
keyring.FileBackend,
},
ServiceName: keyringServiceName,
FileDir: keyringPathEnv,
KeychainTrustApplication: true,
Expand All @@ -64,16 +67,15 @@ func New() (*keyringImpl, error) {
},
}

// Open the keyring
openKeyring, err := keyring.Open(keyringConfig)
if err != nil {
return nil, err
return nil, fmt.Errorf("Unable to open keyring [ %s ]: %w", keyringPathEnv, err)
}

// Get the keyring record
openRecord, err := openKeyring.Get(keyringKeyName)
if err != nil {
return nil, err
return nil, fmt.Errorf("Unable to get keyring record [ %s ]: %w", keyringKeyName, err)
}

// Unmarshal the keyring record
Expand Down

0 comments on commit fb0bdcb

Please sign in to comment.