|
|
|
@ -281,7 +281,7 @@ func (h *httpServer) enableRPC(apis []rpc.API, config httpConfig) error { |
|
|
|
|
|
|
|
|
|
// Create RPC server and handler.
|
|
|
|
|
srv := rpc.NewServer() |
|
|
|
|
if err := RegisterApis(apis, config.Modules, srv, false); err != nil { |
|
|
|
|
if err := RegisterApis(apis, config.Modules, srv); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
h.httpConfig = config |
|
|
|
@ -312,7 +312,7 @@ func (h *httpServer) enableWS(apis []rpc.API, config wsConfig) error { |
|
|
|
|
} |
|
|
|
|
// Create RPC server and handler.
|
|
|
|
|
srv := rpc.NewServer() |
|
|
|
|
if err := RegisterApis(apis, config.Modules, srv, false); err != nil { |
|
|
|
|
if err := RegisterApis(apis, config.Modules, srv); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
h.wsConfig = config |
|
|
|
@ -528,7 +528,7 @@ func (is *ipcServer) stop() error { |
|
|
|
|
|
|
|
|
|
// RegisterApis checks the given modules' availability, generates an allowlist based on the allowed modules,
|
|
|
|
|
// and then registers all of the APIs exposed by the services.
|
|
|
|
|
func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll bool) error { |
|
|
|
|
func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server) error { |
|
|
|
|
if bad, available := checkModuleAvailability(modules, apis); len(bad) > 0 { |
|
|
|
|
log.Error("Unavailable modules in HTTP API list", "unavailable", bad, "available", available) |
|
|
|
|
} |
|
|
|
@ -539,7 +539,7 @@ func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll b |
|
|
|
|
} |
|
|
|
|
// Register all the APIs exposed by the services
|
|
|
|
|
for _, api := range apis { |
|
|
|
|
if exposeAll || allowList[api.Namespace] || (len(allowList) == 0 && api.Public) { |
|
|
|
|
if allowList[api.Namespace] || len(allowList) == 0 { |
|
|
|
|
if err := srv.RegisterName(api.Namespace, api.Service); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|