mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-09 07:20:26 +08:00
实现Web静态文件分发
This commit is contained in:
@@ -188,7 +188,21 @@ func (this *CreateAction) RunPost(params struct {
|
||||
// Web地址
|
||||
switch params.ServerType {
|
||||
case serverconfigs.ServerTypeHTTPWeb:
|
||||
webResp, err := this.RPC().HTTPWebRPC().CreateHTTPWeb(this.AdminContext(), &pb.CreateHTTPWebRequest{Root: params.WebRoot})
|
||||
var rootJSON []byte
|
||||
var err error
|
||||
if len(params.WebRoot) > 0 {
|
||||
rootConfig := &serverconfigs.HTTPRootConfig{}
|
||||
rootConfig.IsOn = true
|
||||
rootConfig.Dir = params.WebRoot
|
||||
rootConfig.Indexes = []string{"index.html", "index.htm"}
|
||||
rootJSON, err = json.Marshal(rootConfig)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
webResp, err := this.RPC().HTTPWebRPC().CreateHTTPWeb(this.AdminContext(), &pb.CreateHTTPWebRequest{RootJSON: rootJSON})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user