liuxiaolong
2019-08-01 abc05dcd6f9ab2ec826c1109afc135e4722d5c28
extend/config/config.go
@@ -11,9 +11,19 @@
   JwtSecret string `mapstructure: "jwtSecret"`
   JwtExpire string `mapstructure: "jwtExpire"`
   Url       string `mapstructure: "url"`
   ImageUrl  string `mapstructure: "imageUrl"`
   NetworkAdapter string `mapstructure: "networkAdapter"`
}
var Server = &server{}
type weedfs struct {
   Ip string `mapstructure: "ip"`
   UploadPort int `mapstructure: "uploadport"`
   VisitPort int `mapstructure: "visitport"`
}
var WeedFs = &weedfs{}
type redis struct {
   Host     string `mapstructure:"host"`
@@ -53,6 +63,13 @@
var DBconf = &database{}
type CompareServer struct {
   Url []string `mapstructure:"url"`
}
var CompServerInfo = &CompareServer{}
// Init is an exported method that takes the environment starts the viper
// (external lib) and returns the configuration struct.
func Init(env string) {
@@ -69,4 +86,6 @@
   viper.UnmarshalKey("server", Server)
   viper.UnmarshalKey("redis", RedisConf)
   viper.UnmarshalKey("database", DBconf)
   viper.UnmarshalKey("weedfs", WeedFs)
   viper.UnmarshalKey("compare", CompServerInfo)
}