liuxiaolong
2019-07-17 808f35709b91aa5aab45860cbce919561c98daff
add weedfs config
3个文件已修改
19 ■■■■ 已修改文件
config/dev.yaml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/fileController.go 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
extend/config/config.go 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config/dev.yaml
@@ -3,7 +3,11 @@
    jwtSecret: BASIC    
    jwtExpire: 24  
    url: http://127.0.0.1:8080
    imageUrl: http://192.168.1.182:6080
    imageUrl: http://192.168.1.203:6080
weedfs:
    ip: 192.168.1.203
    uploadport: 6333
    visitport: 6080
redis:
    host: 127.0.0.1
    port: 6379
controllers/fileController.go
@@ -14,8 +14,10 @@
    "log"
    "mime/multipart"
    "net/http"
    "strconv"
    "strings"
    "webserver/extend/code"
    "webserver/extend/config"
    "webserver/extend/esutil"
    "webserver/extend/util"
    "webserver/models"
@@ -34,7 +36,7 @@
//var picUrlField = "fid"
/**上传方法**/
var weedfsUri = "http://192.168.1.182:6333/submit"
var weedfsUri = "http://"+config.WeedFs.Ip+":"+strconv.Itoa(config.WeedFs.UploadPort)+"/submit"
//var weedfsUri = "http://192.168.1.182:9500/submit"
extend/config/config.go
@@ -16,6 +16,14 @@
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"`
    Port     int    `mapstructure:"port"`
@@ -70,4 +78,5 @@
    viper.UnmarshalKey("server", Server)
    viper.UnmarshalKey("redis", RedisConf)
    viper.UnmarshalKey("database", DBconf)
    viper.UnmarshalKey("weedfs", WeedFs)
}