mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 09:50:50 +00:00
Merge pull request #269 from shavac/master
improve StaticDir config file parser.
This commit is contained in:
commit
00abdcd0a1
11
config.go
11
config.go
@ -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]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user