| 
				
			 | 
			
			
				@@ -1,40 +0,0 @@ 
			 | 
		
	
		
			
			| 
				1
			 | 
			
				
			 | 
			
			
				-package app 
			 | 
		
	
		
			
			| 
				2
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				3
			 | 
			
				
			 | 
			
			
				-import ( 
			 | 
		
	
		
			
			| 
				4
			 | 
			
				
			 | 
			
			
				-	"path/filepath" 
			 | 
		
	
		
			
			| 
				5
			 | 
			
				
			 | 
			
			
				-	"strings" 
			 | 
		
	
		
			
			| 
				6
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				7
			 | 
			
				
			 | 
			
			
				-	"github.com/spf13/viper" 
			 | 
		
	
		
			
			| 
				8
			 | 
			
				
			 | 
			
			
				-) 
			 | 
		
	
		
			
			| 
				9
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				
			 | 
			
			
				-var ( 
			 | 
		
	
		
			
			| 
				11
			 | 
			
				
			 | 
			
			
				-	Config appConfig 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				
			 | 
			
			
				-) 
			 | 
		
	
		
			
			| 
				13
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				
			 | 
			
			
				-type appConfig struct { 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				
			 | 
			
			
				-	DB struct { 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				
			 | 
			
			
				-		Host               string `mapstructure:"host"` 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				
			 | 
			
			
				-		Port               string `mapstructure:"port"` 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				
			 | 
			
			
				-		User               string `mapstructure:"user"` 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				
			 | 
			
			
				-		Password           string `mapstructure:"password"` 
			 | 
		
	
		
			
			| 
				20
			 | 
			
				
			 | 
			
			
				-		Name               string `mapstructure:"name"` 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				
			 | 
			
			
				-		MaxIdleConnections int    `mapstructure:"max_idle_connections"` 
			 | 
		
	
		
			
			| 
				22
			 | 
			
				
			 | 
			
			
				-		MaxOpenConnections int    `mapstructure:"max_idle_connections"` 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				
			 | 
			
			
				-	} `mapstructure:"db"` 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				
			 | 
			
			
				-	Secret struct { 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				
			 | 
			
			
				-		AuthKey string `mapstructure:"auth_key"` 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				
			 | 
			
			
				-	} `mapstructure:"secret"` 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				
			 | 
			
			
				-} 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				
			 | 
			
			
				-func InitConfig(cfg string) { 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				
			 | 
			
			
				-	viper.SetConfigFile(cfg) 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				
			 | 
			
			
				-	viper.SetConfigType(strings.Trim(filepath.Ext(cfg), ".")) 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				
			 | 
			
			
				-	if err := viper.ReadInConfig(); err != nil { 
			 | 
		
	
		
			
			| 
				34
			 | 
			
				
			 | 
			
			
				-		panic(err) 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				
			 | 
			
			
				-	} 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				37
			 | 
			
				
			 | 
			
			
				-	if err := viper.Unmarshal(&Config); err != nil { 
			 | 
		
	
		
			
			| 
				38
			 | 
			
				
			 | 
			
			
				-		panic(err) 
			 | 
		
	
		
			
			| 
				39
			 | 
			
				
			 | 
			
			
				-	} 
			 | 
		
	
		
			
			| 
				40
			 | 
			
				
			 | 
			
			
				-} 
			 |