[add] setup support studio scripts
This commit is contained in:
parent
b814e0726b
commit
b15853d862
1 changed files with 19 additions and 8 deletions
|
|
@ -7,8 +7,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
"github.com/yaoapp/gou/model"
|
"github.com/yaoapp/gou/model"
|
||||||
"github.com/yaoapp/gou/process"
|
"github.com/yaoapp/gou/process"
|
||||||
|
v8 "github.com/yaoapp/gou/runtime/v8"
|
||||||
"github.com/yaoapp/kun/log"
|
"github.com/yaoapp/kun/log"
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/data"
|
"github.com/yaoapp/yao/data"
|
||||||
|
|
@ -305,14 +307,23 @@ func makeSetup(root string, cfg config.Config) error {
|
||||||
return fmt.Errorf("setup studio script %s error", app.Setting.Setup)
|
return fmt.Errorf("setup studio script %s error", app.Setting.Setup)
|
||||||
}
|
}
|
||||||
|
|
||||||
// service := strings.Join(names[1:len(names)-1], ".")
|
service := strings.Join(names[1:len(names)-1], ".")
|
||||||
// method := names[len(names)-1]
|
method := names[len(names)-1]
|
||||||
// req := gou.Yao.New(service, method)
|
|
||||||
// _, err := req.RootCall(cfg)
|
script, err := v8.SelectRoot(service)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
return nil
|
|
||||||
|
sid := uuid.NewString()
|
||||||
|
ctx, err := script.NewContext(fmt.Sprintf("%v", sid), nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer ctx.Close()
|
||||||
|
|
||||||
|
_, err = ctx.Call(method)
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
p, err := process.Of(app.Setting.Setup, cfg)
|
p, err := process.Of(app.Setting.Setup, cfg)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue