fix home directory config not loading (#1282)
leverage `viper.SetConfigType("yaml")` to fix issue regarding home directory configuration failing to load.
			
			
This commit is contained in:
		@ -246,6 +246,7 @@ func initConfig() {
 | 
			
		||||
 | 
			
		||||
		// Search config in home directory with name ".cobra" (without extension).
 | 
			
		||||
		viper.AddConfigPath(home)
 | 
			
		||||
		viper.SetConfigType("yaml")
 | 
			
		||||
		viper.SetConfigName(".cobra")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -67,6 +67,7 @@ func initConfig() {
 | 
			
		||||
 | 
			
		||||
		// Search config in home directory with name ".cobra" (without extension).
 | 
			
		||||
		viper.AddConfigPath(home)
 | 
			
		||||
		viper.SetConfigType("yaml")
 | 
			
		||||
		viper.SetConfigName(".cobra")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								cobra/cmd/testdata/root.go.golden
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								cobra/cmd/testdata/root.go.golden
									
									
									
									
										vendored
									
									
								
							@ -73,6 +73,7 @@ func initConfig() {
 | 
			
		||||
 | 
			
		||||
		// Search config in home directory with name ".testproject" (without extension).
 | 
			
		||||
		viper.AddConfigPath(home)
 | 
			
		||||
		viper.SetConfigType("yaml")
 | 
			
		||||
		viper.SetConfigName(".testproject")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -86,6 +86,7 @@ func initConfig() {
 | 
			
		||||
 | 
			
		||||
		// Search config in home directory with name ".{{ .AppName }}" (without extension).
 | 
			
		||||
		viper.AddConfigPath(home)
 | 
			
		||||
		viper.SetConfigType("yaml")
 | 
			
		||||
		viper.SetConfigName(".{{ .AppName }}")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user