You've already forked step-ca-cli
mirror of
https://github.com/smallstep/cli.git
synced 2025-08-09 03:22:43 +03:00
Add STEP_OPEN_BROWSER env var to skip opening a browser and just output the authURL.
This commit is contained in:
@@ -784,6 +784,9 @@ func (o *oauth) DoLoopbackAuthorization() (*token, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skipBrowser := os.Getenv("STEP_OPEN_BROWSER") == "false"
|
||||||
|
|
||||||
|
if !skipBrowser {
|
||||||
if err := exec.OpenInBrowser(authURL, o.browser); err != nil {
|
if err := exec.OpenInBrowser(authURL, o.browser); err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "Cannot open a web browser on your platform.")
|
fmt.Fprintln(os.Stderr, "Cannot open a web browser on your platform.")
|
||||||
fmt.Fprintln(os.Stderr)
|
fmt.Fprintln(os.Stderr)
|
||||||
@@ -797,6 +800,9 @@ func (o *oauth) DoLoopbackAuthorization() (*token, error) {
|
|||||||
fmt.Fprintln(os.Stderr, authURL)
|
fmt.Fprintln(os.Stderr, authURL)
|
||||||
fmt.Fprintln(os.Stderr)
|
fmt.Fprintln(os.Stderr)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fmt.Fprintln(os.Stderr, authURL)
|
||||||
|
}
|
||||||
|
|
||||||
// Wait for response and return the token
|
// Wait for response and return the token
|
||||||
select {
|
select {
|
||||||
|
Reference in New Issue
Block a user