databricks-cli/cmd
Miles Yucht 5b819cd982
Always resolve .databrickscfg file (#659)
## Changes
#629 introduced a change to autopopulate the host from .databrickscfg if
the user is logging back into a host they were previously using. This
did not respect the DATABRICKS_CONFIG_FILE env variable, causing the
flow to stop working for users with no .databrickscfg file in their home
directory.

This PR refactors all config file loading to go through one interface,
`databrickscfg.GetDatabricksCfg()`, and an auxiliary
`databrickscfg.GetDatabricksCfgPath()` to get the configured file path.

Closes #655.

## Tests
```
$ databricks auth login --profile abc
Error: open /Users/miles/.databrickscfg: no such file or directory

$ ./cli auth login --profile abc
Error: cannot load Databricks config file: open /Users/miles/.databrickscfg: no such file or directory


$ DATABRICKS_CONFIG_FILE=~/.databrickscfg.bak ./cli auth login --profile abc
Databricks Host: https://asdf
```
2023-08-14 12:45:08 +00:00
..
account Bump OpenAPI specification & Go SDK Version (#624) 2023-08-01 12:33:19 +00:00
api Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
auth Always resolve .databrickscfg file (#659) 2023-08-14 12:45:08 +00:00
bundle Add bundle init command and support for prompting user for input values (#631) 2023-08-07 13:14:25 +00:00
configure Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
fs Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
root Always resolve .databrickscfg file (#659) 2023-08-14 12:45:08 +00:00
sync Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
version Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00
workspace Bump OpenAPI specification & Go SDK Version (#624) 2023-08-01 12:33:19 +00:00
cmd.go Remove dependency on global state for remaining commands (#613) 2023-07-27 10:03:08 +00:00