Commit 7fccd48
authored
auth: add DATABRICKS_DISCOVERY_HOST env var to override login.databricks.com (#5283)
## Why
The discovery login flow (`databricks auth login` without `--host`)
opens `https://login.databricks.com`. That host is hardcoded in the CLI,
so there is no way to point the flow at a non-production login instance
during testing or development.
The SDK already exposes `u2m.WithDiscoveryHost` (added in
databricks-sdk-go #1640, on the CLI's pinned v0.132.0). This PR wires it
up.
## Changes
**Before:** No way to override the discovery host. `databricks auth
login` always opens `https://login.databricks.com`.
**Now:** If `DATABRICKS_DISCOVERY_HOST` is set, the CLI passes it
through to `u2m.WithDiscoveryHost(...)`. When unset, behavior is
identical to before. The "Opening ... in your browser..." log line
reflects the override host so it's clear which host is being opened.
Intended for testing and development against non-production login
instances; unset for normal use.
## Test plan
- [x] New unit test `TestDiscoveryLogin_OverridesHostFromEnv` confirms
the env var is read and the log message reflects the override host
- [x] `go test ./cmd/auth/...` passes
- [x] `./task checks` passes
- [x] `./task lint-q` passes1 parent 3204e67 commit 7fccd48
2 files changed
Lines changed: 48 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
49 | 54 | | |
50 | 55 | | |
51 | 56 | | |
| |||
624 | 629 | | |
625 | 630 | | |
626 | 631 | | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
627 | 636 | | |
628 | 637 | | |
629 | 638 | | |
| |||
635 | 644 | | |
636 | 645 | | |
637 | 646 | | |
638 | | - | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
639 | 652 | | |
640 | 653 | | |
641 | 654 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1082 | 1082 | | |
1083 | 1083 | | |
1084 | 1084 | | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
1085 | 1119 | | |
1086 | 1120 | | |
1087 | 1121 | | |
| |||
0 commit comments