diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index c3c7e232..630e750c 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -17,6 +17,8 @@ env: YAO_LOG_MODE: "TEXT" YAO_JWT_SECRET: "bLp@bi!oqo-2U+hoTRUG" YAO_DB_AESKEY: "ZLX=T&f6refeCh-ro*r@" + OSS_TEST_ID: ${{ secrets.OSS_TEST_ID}} + OSS_TEST_SECRET: ${{ secrets.OSS_TEST_SECRET}} ROOT_PLUGIN: ${{ github.WORKSPACE }}/../../../data/gou-unit/plugins jobs: diff --git a/app/app.go b/app/app.go index ceaee231..89dbf283 100644 --- a/app/app.go +++ b/app/app.go @@ -114,18 +114,21 @@ func LoadLang(cfg config.Config) error { var defaults = []share.Script{} if os.Getenv("YAO_DEV") != "" { - defaults = share.GetFilesFS(filepath.Join(os.Getenv("YAO_DEV"), "xiang", "langs"), ".json") + defaults = share.GetFilesFS(filepath.Join(os.Getenv("YAO_DEV"), "xiang"), ".json") } else { - defaults = share.GetFilesBin("/xiang/langs", ".json") + defaults = share.GetFilesBin("xiang", ".json") } for _, lang := range defaults { + if lang.Type != "langs" { + continue + } content := lang.Content - name := strings.ToLower(lang.Type) // 这个读取函数需要优化 + name := strings.ToLower(lang.Name) // 这个读取函数需要优化 lang := map[string]string{} err := jsoniter.Unmarshal(content, &lang) if err != nil { - log.With(log.F{"name": name, "content": content}).Error(err.Error()) + log.With(log.F{"name": name}).Error(err.Error()) } langs[name] = lang } diff --git a/table/table.go b/table/table.go index 166d8981..cbb8c21a 100644 --- a/table/table.go +++ b/table/table.go @@ -11,6 +11,7 @@ import ( "github.com/yaoapp/gou/helper" "github.com/yaoapp/kun/exception" "github.com/yaoapp/kun/log" + "github.com/yaoapp/kun/maps" "github.com/yaoapp/yao/config" "github.com/yaoapp/yao/share" ) @@ -72,7 +73,7 @@ func LoadTable(source string, name string) (*Table, error) { } err := helper.UnmarshalFile(input, &table) if err != nil { - exception.Err(err, 400).Throw() + exception.Err(err, 400).Ctx(maps.Map{"name": name}).Throw() } table.loadColumns() diff --git a/xfs/process_test.go b/xfs/process_test.go index 5424637f..e0af529c 100644 --- a/xfs/process_test.go +++ b/xfs/process_test.go @@ -2,6 +2,7 @@ package xfs import ( "fmt" + "os" "strings" "testing" "time" @@ -19,8 +20,8 @@ func init() { Default: "oss", OSS: &share.AppStorageOSS{ Endpoint: "oss-cn-hangzhou.aliyuncs.com", - ID: "LTAI5tHXfWAMpcsobfqfeXsm", - Secret: "4NeGNw97nFrfmgBWZTlFE0XtYQdMQO", + ID: os.Getenv("OSS_TEST_ID"), + Secret: os.Getenv("OSS_TEST_SECRET"), RoleArn: "acs:ram::31524094:role/ramosstest", SessionName: "SessionTest", },