liuxiaolong
2019-08-20 e8164f07ec594bf7d9574a7f2227e90b87a9f85d
extend/config/config.go
@@ -12,9 +12,19 @@
   JwtExpire string `mapstructure: "jwtExpire"`
   Url       string `mapstructure: "url"`
   ImageUrl  string `mapstructure: "imageUrl"`
   PublicDomain string `mapstructure: "publicDomain"`
   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"`
@@ -54,6 +64,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) {
@@ -70,4 +87,6 @@
   viper.UnmarshalKey("server", Server)
   viper.UnmarshalKey("redis", RedisConf)
   viper.UnmarshalKey("database", DBconf)
   viper.UnmarshalKey("weedfs", WeedFs)
   viper.UnmarshalKey("compare", CompServerInfo)
}