Skip to content

Commit

Permalink
Added support to get current tsh profile.
Browse files Browse the repository at this point in the history
Backported "StatusCurrent" function from 8e18654.
  • Loading branch information
r0mant authored and russjones committed Feb 10, 2021
1 parent 19cca22 commit 4c8f9df
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,18 @@ func readProfile(profileDir string, profileName string) (*ProfileStatus, error)
}, nil
}

// StatusCurrent returns the active profile status.
func StatusCurrent(profileDir, proxyHost string) (*ProfileStatus, error) {
active, _, err := Status(profileDir, proxyHost)
if err != nil {
return nil, trace.Wrap(err)
}
if active == nil {
return nil, trace.NotFound("not logged in")
}
return active, nil
}

// Status returns the active profile as well as a list of available profiles.
func Status(profileDir string, proxyHost string) (*ProfileStatus, []*ProfileStatus, error) {
var err error
Expand Down

0 comments on commit 4c8f9df

Please sign in to comment.