mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 19:50:56 +00:00
fix #238
This commit is contained in:
parent
9fc4cd8958
commit
c1b2e1d0ca
4
beego.go
4
beego.go
@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/astaxie/beego/session"
|
"github.com/astaxie/beego/session"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "0.9.9"
|
const VERSION = "0.9.9"
|
||||||
@ -36,6 +37,9 @@ func SetViewsPath(path string) *App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SetStaticPath(url string, path string) *App {
|
func SetStaticPath(url string, path string) *App {
|
||||||
|
if !strings.HasPrefix(url, "/") {
|
||||||
|
url = "/" + url
|
||||||
|
}
|
||||||
StaticDir[url] = path
|
StaticDir[url] = path
|
||||||
return BeeApp
|
return BeeApp
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -178,6 +179,12 @@ func ParseConfig() (err error) {
|
|||||||
if serverName := AppConfig.String("BeegoServerName"); serverName != "" {
|
if serverName := AppConfig.String("BeegoServerName"); serverName != "" {
|
||||||
BeegoServerName = serverName
|
BeegoServerName = serverName
|
||||||
}
|
}
|
||||||
|
if sd := AppConfig.String("StaticDir"); sd != "" {
|
||||||
|
sds := strings.Split(sd, ",")
|
||||||
|
for _, v := range sds {
|
||||||
|
StaticDir["/"+v] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user