From 0484076372fb17688c45de21d8a42329cac2894a Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 28 Oct 2022 13:18:50 +0800 Subject: [PATCH] [add] setup studio script support --- setup/install.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/setup/install.go b/setup/install.go index 1aa62d0e..7aff2715 100644 --- a/setup/install.go +++ b/setup/install.go @@ -1240,7 +1240,23 @@ func makeSetup(root string) error { if app.Setting != nil && app.Setting.Setup != "" { - p, err := gou.ProcessOf(app.Setting.Setup) + if strings.HasPrefix(app.Setting.Setup, "studio.") { + names := strings.Split(app.Setting.Setup, ".") + if len(names) < 3 { + return fmt.Errorf("setup studio script %s error", app.Setting.Setup) + } + + service := strings.Join(names[1:len(names)-1], ".") + method := names[len(names)-1] + req := gou.Yao.New(service, method) + _, err := req.RootCall(cfg) + if err != nil { + return err + } + return nil + } + + p, err := gou.ProcessOf(app.Setting.Setup, cfg) if err != nil { return err }