00abdcd0 by astaxie

Merge pull request #269 from shavac/master

improve StaticDir config file parser.
2 parents c6167ef1 73a2081a
...@@ -180,9 +180,16 @@ func ParseConfig() (err error) { ...@@ -180,9 +180,16 @@ func ParseConfig() (err error) {
180 BeegoServerName = serverName 180 BeegoServerName = serverName
181 } 181 }
182 if sd := AppConfig.String("StaticDir"); sd != "" { 182 if sd := AppConfig.String("StaticDir"); sd != "" {
183 sds := strings.Split(sd, ",") 183 for k := range StaticDir {
184 delete(StaticDir, k)
185 }
186 sds := strings.Fields(sd)
184 for _, v := range sds { 187 for _, v := range sds {
185 StaticDir["/"+v] = v 188 if url2fsmap := strings.SplitN(v, ":", 2); url2fsmap[1] != "" {
189 StaticDir["/"+url2fsmap[0]] = url2fsmap[1]
190 } else {
191 StaticDir["/"+url2fsmap[0]] = url2fsmap[0]
192 }
186 } 193 }
187 } 194 }
188 } 195 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!