Skip to content

Conversation

@fxck
Copy link
Member

@fxck fxck commented Aug 16, 2025

Summary

  • Add support for ZEROPS_TOKEN environment variable to bypass zcli login
  • Auto-login behavior: automatically saves token and region data to storage
  • Uses identical region fetching logic as login command for consistency
  • Handles missing region data gracefully with default region fallback

Usage

# Set token and get automatically logged in
ZEROPS_TOKEN=your_token_here zcli project list

# Subsequent commands work without env var
zcli service list
zcli deploy

Benefits

  • Developer Experience: One-command authentication setup
  • CI/CD Ready: Perfect for automation and scripts
  • Consistent Behavior: Same validation and storage as zcli login
  • Performance: Subsequent commands use cached region data

Implementation Details

  • Reuses existing region resolution logic from login command
  • Auto-saves token and region data like zcli login does
  • Maintains full backward compatibility with existing authentication
  • No breaking changes to guest commands or stored login sessions

Test plan

  • Build and test CLI with environment token
  • Verify authentication persists after initial env token usage
  • Confirm auto-login saves token and region data to storage
  • Ensure existing login-based authentication continues to work
  • Test fallback behavior for missing region data
  • Verify guest commands remain unaffected

@fxck fxck force-pushed the ar-login-env branch 6 times, most recently from 72cc725 to dd8810e Compare August 16, 2025 19:07
Allow bypassing zcli login by setting ZEROPS_TOKEN environment variable.
When env token is used, automatically fetch and use default region.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@tikinang
Copy link
Collaborator

Some changes are unnecessary, overly complicated. Simpler implementation here: #228

@tikinang tikinang closed this Aug 21, 2025
@tikinang tikinang deleted the ar-login-env branch August 21, 2025 10:54
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.

3 participants