Skip to content

Commit 3bcb036

Browse files
committed
fix: preserve HYPEMAN_BEARER_TOKEN precedence in push command
The push command historically preferred HYPEMAN_BEARER_TOKEN over HYPEMAN_API_KEY. The refactoring to use the shared resolveAPIKey() reversed this precedence, which could cause authentication failures for environments that export both variables. Check HYPEMAN_BEARER_TOKEN first in push, falling back to the shared resolver (HYPEMAN_API_KEY > config file) when it is not set.
1 parent 241adf9 commit 3bcb036

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/cmd/push.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,13 @@ func handlePush(ctx context.Context, cmd *cli.Command) error {
6565
return fmt.Errorf("invalid target: %w", err)
6666
}
6767

68-
token := resolveAPIKey()
68+
// push historically preferred HYPEMAN_BEARER_TOKEN over HYPEMAN_API_KEY.
69+
// Check the legacy variable first to preserve backward compatibility for
70+
// environments that export both.
71+
token := os.Getenv("HYPEMAN_BEARER_TOKEN")
72+
if token == "" {
73+
token = resolveAPIKey()
74+
}
6975

7076
// Use custom transport that always sends Basic auth header
7177
transport := &authTransport{

0 commit comments

Comments
 (0)