From 802870103e286d327b51c841ee3fa2000abdfcf1 Mon Sep 17 00:00:00 2001 From: Youngjin Jo Date: Mon, 4 Nov 2024 19:06:28 +0900 Subject: [PATCH] chore: update yaml directory Signed-off-by: Youngjin Jo --- cmd/root.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index a56884d..bb09f67 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -6,6 +6,7 @@ package cmd import ( "fmt" "os" + "path/filepath" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -41,7 +42,7 @@ func init() { // Cobra supports persistent flags, which, if defined here, // will be global for your application. - rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cfctl.yaml)") + rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.spaceone/cfctl.yaml)") // Cobra also supports local flags, which will only run // when this action is called directly. @@ -58,10 +59,10 @@ func initConfig() { home, err := os.UserHomeDir() cobra.CheckErr(err) - // Search config in home directory with name ".cfctl" (without extension). viper.AddConfigPath(home) + viper.AddConfigPath(filepath.Join(home, ".spaceone")) + viper.SetConfigName("cfctl") viper.SetConfigType("yaml") - viper.SetConfigName(".cfctl") } viper.AutomaticEnv() // read in environment variables that match