Skip to content

Commit

Permalink
chore: set globalConfig up
Browse files Browse the repository at this point in the history
Signed-off-by: Youngjin Jo <[email protected]>
  • Loading branch information
yjinjo committed Nov 22, 2024
1 parent e2014c5 commit 7138f6a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/other/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,20 @@ func getCurrentEnvironment(v *viper.Viper) string {

// updateGlobalConfig prints a success message for global config update
func updateGlobalConfig() {
configPath := filepath.Join(GetConfigDir(), "config.yaml")
v := viper.New()

v.SetConfigFile(configPath)

if err := v.ReadInConfig(); err != nil {
if os.IsNotExist(err) {
pterm.Success.WithShowLineNumber(false).Printfln("Global config updated with existing environments. (default: %s/config.yaml)", GetConfigDir())
return
}
pterm.Warning.Printf("Warning: Could not read global config: %v\n", err)
return
}

pterm.Success.WithShowLineNumber(false).Printfln("Global config updated with existing environments. (default: %s/config.yaml)", GetConfigDir())
}

Expand Down

0 comments on commit 7138f6a

Please sign in to comment.