Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

Description 📣

Fixes an issue where running infisical login --domain "https://eu.infisical.com" still prompts the user to select a hosting option, even though the domain was explicitly specified via the flag.

Problem: When using --domain with EU/US cloud URLs, the CLI would still show the interactive hosting selection prompt:

Use the arrow keys to navigate: ↓ ↑ → ← 
? Select your hosting option: 
  ▸ Infisical Cloud (US Region)
    Infisical Cloud (EU Region)
    Self-Hosting or Dedicated Instance

This made it impossible to script the login flow (e.g., for terraform plan) without human input.

Solution: Check if the --domain flag was explicitly set by the user. If so, use that domain directly without prompting, even for US/EU cloud URLs.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

Manual verification:

  • infisical login --domain "https://eu.infisical.com" should skip the hosting selection prompt
  • infisical login (without --domain) should still show the hosting selection prompt as before

Key areas for review:

  • The boolean logic in shouldUsePresetDomain condition
  • Verify cloud URLs (US/EU) are not being saved to the config file's domains list


Link to Devin run: https://app.devin.ai/sessions/f8e999bcf9bd49f5912415d268f52bce
Requested by: Vlad Matsiiako (@vmatsiiako)

When users pass --domain flag (e.g., --domain https://eu.infisical.com),
the CLI should use that domain directly without prompting for hosting
selection. Previously, the hosting selection prompt would still appear
even when --domain was explicitly provided with EU/US cloud URLs.

This fix checks if the --domain flag was explicitly changed by the user
and if so, uses that domain directly without prompting.

Co-Authored-By: Vlad Matsiiako <vm265@cornell.edu>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 23, 2026

Greptile Overview

Greptile Summary

This PR fixes a bug where the CLI would prompt users to select a hosting option even when the --domain flag was explicitly provided. The fix enables non-interactive login flows (e.g., for Terraform) by checking whether the domain flag was explicitly set using cmd.Flags().Changed("domain").

Key changes:

  • Added domainFlagExplicitlySet boolean to detect when user explicitly provides --domain flag
  • Modified shouldUsePresetDomain logic to bypass prompt when domain flag is explicitly set, even for US/EU cloud URLs
  • Added check to prevent saving default cloud URLs (US/EU) to the config file's domains list

How it works:
The updated logic uses cmd.Flags().Changed("domain") to distinguish between:

  1. User explicitly setting --domain "https://eu.infisical.com" → uses that domain directly without prompting
  2. No --domain flag (uses default) → shows hosting selection prompt as before
  3. --domain set to custom self-hosted URL → uses it directly (existing behavior preserved)

The fix properly handles the edge case where cloud URLs should be used when explicitly specified but not added to the persistent config file.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it's a focused bug fix with clear logic
  • The implementation is straightforward and correctly addresses the issue. The boolean logic is sound, handling all edge cases properly (explicit flag vs default, cloud vs self-hosted). The fix doesn't introduce security vulnerabilities and maintains backward compatibility for users who don't use the --domain flag.
  • No files require special attention

Important Files Changed

Filename Overview
packages/cmd/login.go Fixed hosting selection prompt bypass when --domain flag is explicitly set. Logic correctly handles US/EU cloud URLs and prevents saving them to config file.

@akhilmhdh akhilmhdh merged commit c059c55 into main Jan 23, 2026
5 checks passed
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