Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip opening the default browser if STEP_OPEN_BROWSER=false #1361

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jdoss
Copy link
Contributor

@jdoss jdoss commented Feb 11, 2025

This PR adds support for STEP_OPEN_BROWSER env var which if set to STEP_OPEN_BROWSER=false it will skip opening the default browser and just output the authURL to stderr.

@jdoss jdoss requested review from maraino, hslatman and dopey February 11, 2025 22:32
@github-actions github-actions bot added the needs triage Waiting for discussion / prioritization by team label Feb 11, 2025
@jdoss jdoss changed the title Skip opening the default if STEP_OPEN_BROWSER=false Skip opening the default browser if STEP_OPEN_BROWSER=false Feb 11, 2025
command/oauth/cmd.go Outdated Show resolved Hide resolved
Comment on lines +787 to +790
if skipBrowser := os.Getenv("STEP_OPEN_BROWSER") == "0"; skipBrowser {
fmt.Fprintln(os.Stderr, authURL)
fmt.Fprintln(os.Stderr)
} else {
fmt.Fprintln(os.Stderr, "Your default web browser has been opened to visit:")
fmt.Fprintln(os.Stderr)
fmt.Fprintln(os.Stderr, authURL)
fmt.Fprintln(os.Stderr)
} else {
if err := exec.OpenInBrowser(authURL, o.browser); err != nil {
Copy link
Member

@hslatman hslatman Feb 14, 2025

Choose a reason for hiding this comment

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

Looks like the file needs to be formatted.

The version of the linter to use in CI was updated recently. It needs a rerun with fresh commit to go green, I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Waiting for discussion / prioritization by team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants