Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
Update utils.go (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
npofsi authored Aug 16, 2021
1 parent f932d8b commit 5376628
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,19 @@ func newStorager(pairs ...types.Pair) (store *Storage, err error) {
store.workDir = opt.WorkDir
}

cp, err := credential.Parse(opt.Credential)
if err != nil {
return nil, err
}
switch cp.Protocol() {
case credential.ProtocolBasic:
user, pass := cp.Basic()
store.password = pass
store.user = user
default:
return nil, services.PairUnsupportedError{Pair: ps.WithCredential(opt.Credential)}

if opt.HasCredential {
cp, err := credential.Parse(opt.Credential)
if err != nil {
return nil, err
}
switch cp.Protocol() {
case credential.ProtocolBasic:
user, pass := cp.Basic()
store.password = pass
store.user = user
default:
return nil, services.PairUnsupportedError{Pair: ps.WithCredential(opt.Credential)}
}
}

err = store.connect()
Expand Down

0 comments on commit 5376628

Please sign in to comment.