mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 05:20:49 +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
|
||||
}
|
||||
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