Skip to content

Commit

Permalink
enable wasm filter by default
Browse files Browse the repository at this point in the history
  • Loading branch information
localvar committed Jul 14, 2021
1 parent 7749885 commit 3f96d08
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
18 changes: 8 additions & 10 deletions Makefile
Expand Up @@ -22,16 +22,14 @@ endif
# Build Flags
GO_LD_FLAGS= "-s -w -X github.com/megaease/easegress/pkg/version.RELEASE=${RELEASE} -X github.com/megaease/easegress/pkg/version.COMMIT=${GIT_COMMIT} -X github.com/megaease/easegress/pkg/version.REPO=${GIT_REPO_INFO}"

# Cgo is disabled by default
ENABLE_CGO= CGO_ENABLED=0

# Check Go build tags, the tags are from command line of make
ifdef GOTAGS
GO_BUILD_TAGS= -tags ${GOTAGS}
# Must enable Cgo when wasmfilter is included
ifeq ($(findstring wasmfilter,${GOTAGS}), wasmfilter)
ENABLE_CGO= CGO_ENABLED=1
endif
# Enable Wasm filter by default
ENABLE_CGO= CGO_ENABLED=1
GO_BUILD_TAGS=

# Check if Wasm filter was disabled
ifeq ($(findstring wasmfilter,${DISABLED_FEATURES}), wasmfilter)
GO_BUILD_TAGS= -tags nowasmfilter
ENABLE_CGO= CGO_ENABLED=0
endif

# Targets
Expand Down
6 changes: 3 additions & 3 deletions doc/filters.md
Expand Up @@ -613,16 +613,16 @@ code: /home/megaease/wasm/hello.wasm
timeout: 200ms
```

Note: this filter is disabled in the default build of `Easegress`, it can be enabled by:
Note: this filter is enabled in the default build of `Easegress`, it can be disabled by:

```bash
$ make GOTAGS=wasmfilter
$ make DISABLED_FEATURES=wasmfilter
```

or

```bash
$ go build -tags=wasmfilter
$ go build -tags=nowasmfilter
```

### Configuration
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/wasm.go
@@ -1,4 +1,4 @@
// +build wasmfilter
// +build !nowasmfilter

/*
* Copyright (c) 2017, MegaEase
Expand Down
2 changes: 1 addition & 1 deletion pkg/filter/wasm/hostfunc.go
@@ -1,4 +1,4 @@
// +build wasmfilter
// +build !nowasmfilter

/*
* Copyright (c) 2017, MegaEase
Expand Down
2 changes: 1 addition & 1 deletion pkg/filter/wasm/vm.go
@@ -1,4 +1,4 @@
// +build wasmfilter
// +build !nowasmfilter

/*
* Copyright (c) 2017, MegaEase
Expand Down
2 changes: 1 addition & 1 deletion pkg/filter/wasm/wasm.go
@@ -1,4 +1,4 @@
// +build wasmfilter
// +build !nowasmfilter

/*
* Copyright (c) 2017, MegaEase
Expand Down

0 comments on commit 3f96d08

Please sign in to comment.