Skip to content

Commit

Permalink
Make JSVM the default driver (#1888)
Browse files Browse the repository at this point in the history
* api_loader: use mwDriver as the middleware driver, fixes #1887

* coprocess_bundle: only call HandleMiddlewareCache when using rich plugins
  • Loading branch information
matiasinsaurralde authored and buger committed Sep 4, 2018
1 parent aa96862 commit ac789fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion api_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,10 @@ func processSpec(spec *APISpec, apisByListen map[string]int,
"api_name": spec.Name,
}).Debug("Loading Middleware")
var mwPaths []string

mwPaths, mwAuthCheckFunc, mwPreFuncs, mwPostFuncs, mwPostAuthCheckFuncs, mwDriver = loadCustomMiddleware(spec)

if spec.CustomMiddleware.Driver == apidef.OttoDriver {
if mwDriver == apidef.OttoDriver {
spec.JSVM.LoadJSPaths(mwPaths, prefix)
}

Expand Down
3 changes: 2 additions & 1 deletion coprocess_bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ func (b *Bundle) Verify() error {
func (b *Bundle) AddToSpec() {
b.Spec.CustomMiddleware = b.Manifest.CustomMiddleware

if GlobalDispatcher != nil {
// Call HandleMiddlewareCache only when using rich plugins:
if GlobalDispatcher != nil && b.Spec.CustomMiddleware.Driver != apidef.OttoDriver {
GlobalDispatcher.HandleMiddlewareCache(&b.Manifest, b.Path)
}
}
Expand Down

0 comments on commit ac789fb

Please sign in to comment.