Skip to content

Commit

Permalink
add jsvm to lint schema and update otto vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblakeley committed Nov 6, 2018
1 parent a7b8e32 commit f93d402
Show file tree
Hide file tree
Showing 12 changed files with 169 additions and 20 deletions.
3 changes: 3 additions & 0 deletions cli/lint/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ const confSchema = `{
"enable_jsvm": {
"type": "boolean"
},
"jsvm":{
"type": "string"
},
"jsvm_timeout": {
"type": "integer"
},
Expand Down
3 changes: 2 additions & 1 deletion jsvm_goja.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ import (
"time"

"github.com/Sirupsen/logrus"
"github.com/dop251/goja"

"github.com/TykTechnologies/tyk/apidef"
"github.com/TykTechnologies/tyk/config"
"github.com/TykTechnologies/tyk/user"
"github.com/dop251/goja"
)

type TykJSVM interface {
Expand Down
5 changes: 3 additions & 2 deletions jsvm_otto.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import (
"strings"
"time"

"github.com/robertkrimen/otto"
_ "github.com/robertkrimen/otto/underscore"

"github.com/TykTechnologies/tyk/apidef"
"github.com/TykTechnologies/tyk/config"
"github.com/TykTechnologies/tyk/user"
"github.com/robertkrimen/otto"
_ "github.com/robertkrimen/otto/underscore"

"github.com/Sirupsen/logrus"
)
Expand Down
1 change: 1 addition & 0 deletions mw_js_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func (d *DynamicMiddleware) ProcessRequest(w http.ResponseWriter, r *http.Reques
err, code, returnDataStr := d.Spec.JSVM.RunJSRequestDynamic(d, logger, string(requestAsJson), string(sessionAsJson), specAsJson)
if err != nil {
log.Errorf("JSVM error: %v", err)
return err, code
}

if code != -1 {
Expand Down
5 changes: 2 additions & 3 deletions mw_virtual_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -158,8 +157,8 @@ func (d *VirtualEndpoint) ServeHTTPForCache(w http.ResponseWriter, r *http.Reque
// Run the middleware
err, code, returnDataStr := d.Spec.JSVM.RunJSRequestVirtual(d, d.logger, vmeta, string(requestAsJson), string(sessionAsJson), specAsJson)
if err != nil {
//TODO
fmt.Println(err)
log.Errorf("JSVM VE error: %v", err)
return nil
}
if code != -1 {
return nil
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/robertkrimen/otto/README.markdown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion vendor/github.com/robertkrimen/otto/builtin_array.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/robertkrimen/otto/error.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions vendor/github.com/robertkrimen/otto/inline.pl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 93 additions & 1 deletion vendor/github.com/robertkrimen/otto/runtime.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 49 additions & 1 deletion vendor/github.com/robertkrimen/otto/type_function.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,10 @@
"revisionTime": "2016-01-27T17:00:04Z"
},
{
"checksumSHA1": "ZSYig6eYkc34ELHl6O5gRtJvr6o=",
"checksumSHA1": "WdorbyEJiNbjIOiQzM4TLb/XA7Q=",
"path": "github.com/robertkrimen/otto",
"revision": "fc2eb1bbf1c5c462313c810bb02dc93cd964aebe",
"revisionTime": "2017-07-21T19:43:36Z"
"revision": "15f95af6e78dcd2030d8195a138bd88d4f403546",
"revisionTime": "2018-06-17T13:11:54Z"
},
{
"checksumSHA1": "q1HKpLIWi3tTT5W5LqMlwPcGmyQ=",
Expand Down

0 comments on commit f93d402

Please sign in to comment.