1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-23 10:00:50 +00:00

Merge pull request #269 from shavac/master

improve StaticDir config file parser.
This commit is contained in:
astaxie 2013-10-31 20:02:53 -07:00
commit 00abdcd0a1

View File

@ -180,9 +180,16 @@ func ParseConfig() (err error) {
BeegoServerName = serverName BeegoServerName = serverName
} }
if sd := AppConfig.String("StaticDir"); sd != "" { 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 { 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]
}
} }
} }
} }