1
0
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:
knightmare shava 2013-11-01 08:23:57 +08:00
parent c6167ef184
commit 73a2081ae7

View File

@ -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]
}
}
}
}