mirror of
https://github.com/astaxie/beego.git
synced 2024-12-22 19:20:48 +00:00
improve StaticDir config file parser.New style is like "css:static/css js:static/js"
This commit is contained in:
parent
c6167ef184
commit
73a2081ae7
11
config.go
11
config.go
@ -180,9 +180,16 @@ func ParseConfig() (err error) {
|
||||
BeegoServerName = serverName
|
||||
}
|
||||
if sd := AppConfig.String("StaticDir"); sd != "" {
|
||||
sds := strings.Split(sd, ",")
|
||||
for k := range StaticDir {
|
||||
delete(StaticDir, k)
|
||||
}
|
||||
sds := strings.Fields(sd)
|
||||
for _, v := range sds {
|
||||
StaticDir["/"+v] = v
|
||||
if url2fsmap := strings.SplitN(v, ":", 2); url2fsmap[1] != "" {
|
||||
StaticDir["/"+url2fsmap[0]] = url2fsmap[1]
|
||||
} else {
|
||||
StaticDir["/"+url2fsmap[0]] = url2fsmap[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user