cli: Handle missing home directory
Some checks failed
Tests and linters / Run gofumpt (pull_request) Successful in 1m40s
DCO action / DCO (pull_request) Failing after 2m36s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m41s
Tests and linters / Staticcheck (pull_request) Successful in 3m30s
Vulncheck / Vulncheck (pull_request) Successful in 3m56s
Tests and linters / Lint (pull_request) Successful in 4m0s
Build / Build Components (pull_request) Successful in 4m44s
Tests and linters / gopls check (pull_request) Successful in 4m40s
Tests and linters / Tests (pull_request) Successful in 7m56s
Tests and linters / Tests with -race (pull_request) Successful in 8m3s
Some checks failed
Tests and linters / Run gofumpt (pull_request) Successful in 1m40s
DCO action / DCO (pull_request) Failing after 2m36s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m41s
Tests and linters / Staticcheck (pull_request) Successful in 3m30s
Vulncheck / Vulncheck (pull_request) Successful in 3m56s
Tests and linters / Lint (pull_request) Successful in 4m0s
Build / Build Components (pull_request) Successful in 4m44s
Tests and linters / gopls check (pull_request) Successful in 4m40s
Tests and linters / Tests (pull_request) Successful in 7m56s
Tests and linters / Tests with -race (pull_request) Successful in 8m3s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
81f4cdbb91
commit
416871f3d3
1 changed files with 8 additions and 6 deletions
|
@ -114,12 +114,14 @@ func initConfig() {
|
|||
} else {
|
||||
// Find home directory.
|
||||
home, err := homedir.Dir()
|
||||
commonCmd.ExitOnErr(rootCmd, "", err)
|
||||
|
||||
// Search config in `$HOME/.config/frostfs-cli/` with name "config.yaml"
|
||||
viper.AddConfigPath(filepath.Join(home, ".config", "frostfs-cli"))
|
||||
viper.SetConfigName("config")
|
||||
viper.SetConfigType("yaml")
|
||||
if err != nil {
|
||||
common.PrintVerbose(rootCmd, "Get homedir: %s", err)
|
||||
} else {
|
||||
// Search config in `$HOME/.config/frostfs-cli/` with name "config.yaml"
|
||||
viper.AddConfigPath(filepath.Join(home, ".config", "frostfs-cli"))
|
||||
viper.SetConfigName("config")
|
||||
viper.SetConfigType("yaml")
|
||||
}
|
||||
}
|
||||
|
||||
viper.SetEnvPrefix(envPrefix)
|
||||
|
|
Loading…
Reference in a new issue