Skip to content

fix: logout message when auth token env var is set#60

Merged
carole-lavillonniere merged 1 commit intomainfrom
fix-logout-env-var
Mar 3, 2026
Merged

fix: logout message when auth token env var is set#60
carole-lavillonniere merged 1 commit intomainfrom
fix-logout-env-var

Conversation

@carole-lavillonniere
Copy link
Collaborator

Fix message when the user is trying to logout but they are authenticated using the LOCALSTACK_AUTH_TOKEN env var:
logout

@carole-lavillonniere carole-lavillonniere marked this pull request as ready for review March 3, 2026 09:19
@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a84a8c7 and 22e2ce7.

📒 Files selected for processing (2)
  • internal/auth/auth.go
  • test/integration/logout_test.go

📝 Walkthrough

Walkthrough

The PR refines logout behavior to handle environment-based tokens separately from missing tokens, adding LOCALSTACK_AUTH_TOKEN environment variable detection with granular error handling. Corresponding integration tests verify both the new environment token case and the absence case.

Changes

Cohort / File(s) Summary
Auth Logout Logic
internal/auth/auth.go
Refactored Logout() to check for LOCALSTACK_AUTH_TOKEN environment variable and distinguish between env-provided tokens (skip logout with note), missing tokens (emit "Not currently logged in"), and other read errors (return wrapped error). Removes unconditional error failure path.
Integration Tests
test/integration/logout_test.go
Added TestLogoutCommandWithEnvVarToken to verify logout behavior when environment variable token is present. Updated TestLogoutCommandSucceedsWhenNoToken to explicitly clear auth token from environment to ensure clean test isolation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Rename auth token env var #44: Renames auth token environment variable to LOCALSTACK_AUTH_TOKEN; this PR updates logout to recognize and handle that same environment variable.

Suggested reviewers

  • silv-io
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing the logout message when authentication is handled via the LOCALSTACK_AUTH_TOKEN environment variable.
Description check ✅ Passed The description is directly related to the changeset, explaining the fix for logout message handling when LOCALSTACK_AUTH_TOKEN env var is set, supported by a terminal output screenshot.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-logout-env-var

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Member

@silv-io silv-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean! :)

@carole-lavillonniere carole-lavillonniere merged commit 531b7ec into main Mar 3, 2026
8 checks passed
@carole-lavillonniere carole-lavillonniere deleted the fix-logout-env-var branch March 3, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants