feat(routers): 平台后台 SPA 由 Go 自己吐,绕开 nginx 反代缺失
This commit is contained in:
1 parent
d48c012e68
commit
5718a00e31
4 files changed
+106
No files matched your search
@@ -2,6 +2,7 @@ package routers
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"server/controllers"
|
||||
"server/middleware"
|
||||
@@ -87,4 +88,18 @@ func init() {
|
||||
platform.Register()
|
||||
api.Register()
|
||||
}
|
||||
|
||||
// 平台后台 SPA 静态托管(详见 routers/spa.go 注释)。
|
||||
// 由 app.conf 的 platform_spa_dir / platform_spa_hosts 控制;任一为空则不启用。
|
||||
if spaDir, _ := beego.AppConfig.String("platform_spa_dir"); strings.TrimSpace(spaDir) != "" {
|
||||
var hosts []string
|
||||
if raw, _ := beego.AppConfig.String("platform_spa_hosts"); raw != "" {
|
||||
for _, h := range strings.Split(raw, ",") {
|
||||
if t := strings.TrimSpace(h); t != "" {
|
||||
hosts = append(hosts, t)
|
||||
}
|
||||
}
|
||||
}
|
||||
RegisterPlatformSPA(spaDir, hosts...)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user