update readme for filter

This commit is contained in:
Adil Hafeez 2024-10-08 15:32:49 -07:00
parent 80d2229053
commit fab71abdac

View file

@ -17,55 +17,20 @@ $ cargo build --target wasm32-wasi --release
$ cargo test
```
## Using in Envoy
## Local development
- Build docker image for arch gateway. Note this needs to be built once.
```
$ sh build_filter_image.sh
```
This example can be run with [`docker compose`](https://docs.docker.com/compose/install/)
and has a matching Envoy configuration.
```sh
$ docker compose up
```
## Examples
### Direct response.
Send HTTP request to `localhost:10000/hello`:
```sh
$ curl localhost:10000/hello
```
Expected response:
```console
HTTP/1.1 200 OK
content-length: 40
content-type: text/plain
custom-header: katanemo filter
date: Wed, 10 Jul 2024 16:59:43 GMT
server: envoy
```
### Inline call.
Send HTTP request to `localhost:10000/inline`:
```sh
$ curl localhost:10000/hello
{
"headers": {
"Accept": "*/*",
"Host": "localhost",
"User-Agent": "curl/7.81.0",
"X-Amzn-Trace-Id": "Root=1-637c4767-6e31776a0b407a0219b5b570",
"X-Envoy-Expected-Rq-Timeout-Ms": "15000"
}
}
```
Expected Envoy logs:
```console
[...] wasm log http_auth_random: Access granted.
```
- Build filter binary,
```
$ cargo build --target wasm32-wasi --release
```
- Start envoy with arch_config.yaml and test,
```
$ docker compose -f docker-compose.dev.yaml up archgw
```
- dev version of docker-compose file uses following files that are mounted inside the container. That means no docker rebuild is needed if any of these files change. Just restart the container and chagne will be picked up,
- - envoy.template.yaml
- - intelligent_prompt_gateway.wasm