Skip to content

Commit

Permalink
pass backendtype to getkeyring
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Kania committed Apr 23, 2020
1 parent 74e5a68 commit 54d655b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,10 @@ func (u *User) RemoveVaultSession() error {
return nil
}

func getKeyring(keychainName string) (*keyring.Keyring, error) {
func getKeyring(keychainName string, backendType keyring.BackendType) (*keyring.Keyring, error) {
ring, err := keyring.Open(keyring.Config{
ServiceName: "aws-vault",
AllowedBackends: keyring.AvailableBackends(),
AllowedBackends: []keyring.BackendType{backendType},
KeychainName: keychainName,
KeychainTrustApplication: true,
})
Expand Down Expand Up @@ -487,7 +487,7 @@ func main() {
if keychainName == "" {
keychainName = "login"
}
keyring, err := getKeyring(keychainName)
keyring, err := getKeyring(keychainName, keyring.KeychainBackend)
if err != nil {
log.Fatal(err)
}
Expand Down
3 changes: 2 additions & 1 deletion cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"testing"

"github.com/99designs/aws-vault/vault"
"github.com/99designs/keyring"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -36,7 +37,7 @@ func TestExistingAWSProfile(t *testing.T) {
"123456789", "engineer"),
Region: "us-west-2",
}
keyring, err := getKeyring("test")
keyring, err := getKeyring("test", keyring.FileBackend)
assert.NoError(t, err)
user := User{
Name: "test",
Expand Down

0 comments on commit 54d655b

Please sign in to comment.