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

This commit is contained in:
Todd authored and Johan Brandhorst-Satzkorn committed 2024-01-05 07:43:20 -08:00
1 parent ab4ab0e8f9
commit 9448fc931e
1 file changed
+12 -7
+12 -7
View File
@@ -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)