Remove deprecated import and storage API loading from the codebase

This commit is contained in:
Max 2024-11-06 09:25:29 +08:00
parent f0a4a8d4ea
commit c5a5a8432f
3 changed files with 2 additions and 27 deletions

View file

@ -2,13 +2,11 @@ package api
import (
"fmt"
"path/filepath"
"strings"
"github.com/yaoapp/gou/api"
"github.com/yaoapp/gou/application"
"github.com/yaoapp/yao/config"
"github.com/yaoapp/yao/data"
"github.com/yaoapp/yao/share"
)
@ -28,23 +26,6 @@ func Load(cfg config.Config) error {
return err
}, exts...)
// Load APIs from bindata (**will be removed in the future**)
names := []string{"import", "storage"}
for _, name := range names {
file := filepath.Join("yao", "apis", fmt.Sprintf("%s.http.json", name))
id := fmt.Sprintf("xiang.%s", name)
source, err := data.Read(file)
if err != nil {
messages = append(messages, err.Error())
}
_, err = api.LoadSource(file, source, id)
if err != nil {
messages = append(messages, err.Error())
}
}
if len(messages) > 0 {
return fmt.Errorf(strings.Join(messages, ";\n"))
}

View file

@ -25,8 +25,8 @@ func check(t *testing.T) {
assert.True(t, ids["user"])
assert.True(t, ids["user.pet"])
assert.True(t, ids["xiang.import"]) // will be removed in the future
assert.True(t, ids["xiang.storage"]) // will be removed in the future
// assert.True(t, ids["xiang.import"]) // will be removed in the future
// assert.True(t, ids["xiang.storage"]) // will be removed in the future
// wskeys := []string{}
// for key := range websocket.Upgraders {

View file

@ -385,12 +385,6 @@ func Reload(cfg config.Config, options LoadOption) (err error) {
printErr(cfg.Mode, "Widgets", err)
}
// Load Importers
err = importer.Load(cfg)
if err != nil {
printErr(cfg.Mode, "Plugin", err)
}
// Load Apis
err = api.Load(cfg) // 加载业务接口 API
if err != nil {