Search uses base.Client's token to perform the search (#4006)

pull/4202/head
Todd 2 years ago committed by Johan Brandhorst-Satzkorn
parent ab4ab0e8f9
commit 9448fc931e

@ -142,18 +142,23 @@ func (c *SearchCommand) Run(args []string) int {
}
func (c *SearchCommand) Search(ctx context.Context) (*api.Response, error) {
keyringType, tokenName, err := c.DiscoverKeyringTokenInfo()
client, err := c.Client()
if err != nil {
return nil, err
}
t := client.Token()
if t == "" {
return nil, fmt.Errorf("Auth Token selected for searching is empty.")
}
tSlice := strings.SplitN(t, "_", 3)
if len(tSlice) != 3 {
return nil, fmt.Errorf("Auth Token selected for searching is in an unexpected format.")
}
tf := filterBy{
flagQuery: c.flagQuery,
resource: c.flagResource,
}
at := c.ReadTokenFromKeyring(keyringType, tokenName)
if at != nil {
tf.authTokenId = at.Id
flagQuery: c.flagQuery,
resource: c.flagResource,
authTokenId: strings.Join(tSlice[:2], "_"),
}
dotPath, err := daemoncmd.DefaultDotDirectory(ctx)

Loading…
Cancel
Save