diff --git a/build/resources/apinto.yml b/build/resources/apinto.yml index 0e11d48d..d490fb5a 100644 --- a/build/resources/apinto.yml +++ b/build/resources/apinto.yml @@ -1,20 +1,20 @@ # 数据文件放置目录 -# data_dir: /var/lib/apinto +# data_dir: /var/lib/goku # pid文件放置地址 -# pid_dir: /var/run/apinto/ +# pid_dir: /var/run/goku/ # 日志放置目录 -# log_dir: /var/log/apinto +# log_dir: /var/log/goku # socket放置目录 -# socket_dir: /tmp/apinto +# socket_dir: /tmp/goku -# apinto运行配置地址 -# config: /etc/apinto/config.yml +# goku运行配置地址 +# config: /etc/goku/config.yml # 扩展仓库目录 -# extends_dir: /var/lib/apinto/extends/ +# extends_dir: /var/lib/goku/extenders/ # 错误日志文件名 # error_log_name: error.log diff --git a/drivers/router/http-router/handler.go b/drivers/router/http-router/handler.go index 7f423e7b..7176214a 100644 --- a/drivers/router/http-router/handler.go +++ b/drivers/router/http-router/handler.go @@ -2,16 +2,13 @@ package http_router import ( "fmt" - http_service "github.com/eolinker/eosc/http-service" service "github.com/eolinker/eosc/http-service" - "github.com/eolinker/apinto/plugin" - router_http "github.com/eolinker/apinto/router/router-http" - service2 "github.com/eolinker/apinto/service" + router_http "github.com/eolinker/goku/router/router-http" + service2 "github.com/eolinker/goku/service" ) type RouterHandler struct { routerConfig *router_http.Config - routerFilters http_service.IChain serviceFilter service2.IService } @@ -25,18 +22,13 @@ func (r *RouterHandler) Destroy() { r.serviceFilter = nil s.Destroy() } - rh := r.routerFilters - if rh != nil { - r.routerFilters = nil - rh.Destroy() - } + } -func NewRouterHandler(routerConfig *router_http.Config, routerPlugin plugin.IPlugin, handler service2.IService) *RouterHandler { +func NewRouterHandler(routerConfig *router_http.Config, handler service2.IService) *RouterHandler { r := &RouterHandler{routerConfig: routerConfig, serviceFilter: handler} - r.routerFilters = routerPlugin.Append(r) - routerConfig.Target = r.routerFilters + routerConfig.Target = handler return r } diff --git a/drivers/router/http-router/router.go b/drivers/router/http-router/router.go index 2c4b38fb..a1685e31 100644 --- a/drivers/router/http-router/router.go +++ b/drivers/router/http-router/router.go @@ -3,9 +3,8 @@ package http_router import ( "github.com/eolinker/eosc" "github.com/eolinker/eosc/log" - "github.com/eolinker/apinto/plugin" - router_http "github.com/eolinker/apinto/router/router-http" - "github.com/eolinker/apinto/service" + router_http "github.com/eolinker/goku/router/router-http" + "github.com/eolinker/goku/service" ) //Router http路由驱动实例结构体,实现了worker接口 @@ -27,13 +26,8 @@ func (r *Router) create(cf *DriverConfig, target service.IServiceCreate) (*Route if cf.Disable { return NewDisableHandler(newConf), nil } - routerPluginConfig := cf.Plugins - if pluginConfigMerge, ok := target.(plugin.IPluginConfigMerge); ok { - routerPluginConfig = pluginConfigMerge.Merge(routerPluginConfig) - } - routerPlugin := r.driver.pluginManager.CreateRouter(r.id, routerPluginConfig) serviceHandler := target.Create(r.id, cf.Plugins) - handler := NewRouterHandler(newConf, routerPlugin, serviceHandler) + handler := NewRouterHandler(newConf, serviceHandler) return handler, nil } func (r *Router) Reset(conf interface{}, workers map[eosc.RequireId]interface{}) error { diff --git a/drivers/service/service-http/handler.go b/drivers/service/service-http/handler.go index b854a5a6..18e962b2 100644 --- a/drivers/service/service-http/handler.go +++ b/drivers/service/service-http/handler.go @@ -58,7 +58,7 @@ func (s *ServiceHandler) Destroy() { func (s *ServiceHandler) rebuild() { config := s.service.Merge(s.routerPluginConfig) - s.pluginOrg = pluginManger.CreateService(s.id, config) + s.pluginOrg = pluginManger.CreateRequest(s.id, config) s.pluginExec = s.pluginOrg.Append(filter.ToFilter([]http_service.IFilter{s})) configToUpstream := plugin.MergeConfig(s.routerPluginConfig, s.service.configs) diff --git a/plugin-manager/config.go b/plugin-manager/config.go index cb6bdada..cb4574d3 100644 --- a/plugin-manager/config.go +++ b/plugin-manager/config.go @@ -5,8 +5,7 @@ const ( StatusEnable = "enable" StatusGlobal = "global" - pluginRouter = "router" - pluginService = "service" + pluginRequest = "request" pluginUpstream = "upstream" ) diff --git a/plugin-manager/manager.go b/plugin-manager/manager.go index ab2509a3..c1c38cc5 100644 --- a/plugin-manager/manager.go +++ b/plugin-manager/manager.go @@ -35,12 +35,8 @@ type PluginManager struct { workers eosc.IWorkers } -func (p *PluginManager) CreateRouter(id string, conf map[string]*plugin.Config) plugin.IPlugin { - return p.createChain(id, conf, pluginRouter) -} - -func (p *PluginManager) CreateService(id string, conf map[string]*plugin.Config) plugin.IPlugin { - return p.createChain(id, conf, pluginService) +func (p *PluginManager) CreateRequest(id string, conf map[string]*plugin.Config) plugin.IPlugin { + return p.createChain(id, conf, pluginRequest) } func (p *PluginManager) CreateUpstream(id string, conf map[string]*plugin.Config) plugin.IPlugin { diff --git a/plugin/plugin.go b/plugin/plugin.go index 16a338c7..0540ec2d 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -17,8 +17,7 @@ type IPlugin interface { Destroy() } type IPluginManager interface { - CreateRouter(id string, conf map[string]*Config) IPlugin - CreateService(id string, conf map[string]*Config) IPlugin + CreateRequest(id string, conf map[string]*Config) IPlugin CreateUpstream(id string, conf map[string]*Config) IPlugin } diff --git a/professions/professions.go b/professions/professions.go index 28b87a4c..622826d4 100644 --- a/professions/professions.go +++ b/professions/professions.go @@ -6,7 +6,7 @@ import ( ) const ( - SpaceProfession = "profession-admin" + SpaceProfession = "professions" ) type Professions struct { @@ -18,10 +18,10 @@ func NewProfessions() (*Professions, error) { p := &Professions{ Professions: professions.NewProfessions(), } - p.Professions.Reset(ApintoProfession()) + p.Professions.Reset(GokuProfession()) return p, nil } func (p *Professions) Reset([]*eosc.ProfessionConfig) { return -} +} \ No newline at end of file diff --git a/router/router-http/routers.go b/router/router-http/routers.go index 64bddbe8..ef5a49d3 100644 --- a/router/router-http/routers.go +++ b/router/router-http/routers.go @@ -29,7 +29,7 @@ func (rs *Routers) Set(port int, id string, conf *Config) (IRouter, bool, error) //若对应端口不存在路由树,则新建 if !has { - globalRouterFilter := rs.pluginManager.CreateRouter(name, map[string]*plugin.Config{}) + globalRouterFilter := rs.pluginManager.CreateRequest(name, map[string]*plugin.Config{}) router := NewRouter(globalRouterFilter) err := router.SetRouter(id, conf) if err != nil {