Remove deprecated import and storage API loading from the codebase
This commit is contained in:
parent
f0a4a8d4ea
commit
c5a5a8432f
3 changed files with 2 additions and 27 deletions
19
api/api.go
19
api/api.go
|
|
@ -2,13 +2,11 @@ package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/yaoapp/gou/api"
|
"github.com/yaoapp/gou/api"
|
||||||
"github.com/yaoapp/gou/application"
|
"github.com/yaoapp/gou/application"
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
"github.com/yaoapp/yao/data"
|
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -28,23 +26,6 @@ func Load(cfg config.Config) error {
|
||||||
return err
|
return err
|
||||||
}, exts...)
|
}, 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 {
|
if len(messages) > 0 {
|
||||||
return fmt.Errorf(strings.Join(messages, ";\n"))
|
return fmt.Errorf(strings.Join(messages, ";\n"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@ func check(t *testing.T) {
|
||||||
assert.True(t, ids["user"])
|
assert.True(t, ids["user"])
|
||||||
assert.True(t, ids["user.pet"])
|
assert.True(t, ids["user.pet"])
|
||||||
|
|
||||||
assert.True(t, ids["xiang.import"]) // 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
|
// assert.True(t, ids["xiang.storage"]) // will be removed in the future
|
||||||
|
|
||||||
// wskeys := []string{}
|
// wskeys := []string{}
|
||||||
// for key := range websocket.Upgraders {
|
// for key := range websocket.Upgraders {
|
||||||
|
|
|
||||||
|
|
@ -385,12 +385,6 @@ func Reload(cfg config.Config, options LoadOption) (err error) {
|
||||||
printErr(cfg.Mode, "Widgets", err)
|
printErr(cfg.Mode, "Widgets", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load Importers
|
|
||||||
err = importer.Load(cfg)
|
|
||||||
if err != nil {
|
|
||||||
printErr(cfg.Mode, "Plugin", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load Apis
|
// Load Apis
|
||||||
err = api.Load(cfg) // 加载业务接口 API
|
err = api.Load(cfg) // 加载业务接口 API
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue