| 520 | } |
| 521 | |
| 522 | func (s *GitTokenStore) resolveAuthPath(auth *cliproxyauth.Auth) (string, error) { |
| 523 | if auth == nil { |
| 524 | return "", fmt.Errorf("auth filestore: auth is nil") |
| 525 | } |
| 526 | if auth.Attributes != nil { |
| 527 | if p := strings.TrimSpace(auth.Attributes["path"]); p != "" { |
| 528 | return p, nil |
| 529 | } |
| 530 | } |
| 531 | if fileName := strings.TrimSpace(auth.FileName); fileName != "" { |
| 532 | if filepath.IsAbs(fileName) { |
| 533 | return fileName, nil |
| 534 | } |
| 535 | if dir := s.baseDirSnapshot(); dir != "" { |
| 536 | return filepath.Join(dir, fileName), nil |
| 537 | } |
| 538 | return fileName, nil |
| 539 | } |
| 540 | if auth.ID == "" { |
| 541 | return "", fmt.Errorf("auth filestore: missing id") |
| 542 | } |
| 543 | if filepath.IsAbs(auth.ID) { |
| 544 | return auth.ID, nil |
| 545 | } |
| 546 | dir := s.baseDirSnapshot() |
| 547 | if dir == "" { |
| 548 | return "", fmt.Errorf("auth filestore: directory not configured") |
| 549 | } |
| 550 | return filepath.Join(dir, auth.ID), nil |
| 551 | } |
| 552 | |
| 553 | func (s *GitTokenStore) labelFor(metadata map[string]any) string { |
| 554 | if metadata == nil { |