mirror of
https://github.com/kemko/reproxy.git
synced 2026-01-01 15:55:49 +03:00
add file example
This commit is contained in:
13
examples/file/Makefile
Normal file
13
examples/file/Makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
run: install
|
||||
whoami -port 8081 -name=svc1 &
|
||||
whoami -port 8082 -name=svc2 &
|
||||
whoami -port 8083 -name=svc3 &
|
||||
../../dist/reproxy --file.enabled --file.name=reproxy.yml
|
||||
pkill -9 whoami
|
||||
|
||||
kill:
|
||||
pkill -9 whoami
|
||||
|
||||
install:
|
||||
cd ../../app && CGO_ENABLED=0 go build -o ../dist/reproxy
|
||||
cd /tmp && go install github.com/traefik/whoami@latest
|
||||
12
examples/file/README.md
Normal file
12
examples/file/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Example of a file provider
|
||||
|
||||
To run it do `make run` and try to hit it, for example
|
||||
- `curl localhost:8080/api/svc1/aaaaa`
|
||||
- `curl localhost:8080/api/svc1`
|
||||
- `curl localhost:8080/api/svc2/something`
|
||||
- `curl localhost:8080/api/svc3/something`
|
||||
- `curl 127.0.0.1:8080/api/svc3/something`
|
||||
|
||||
for health check try - `curl localhost:8080/health`
|
||||
|
||||
In order to kill all services run `make kill`
|
||||
5
examples/file/reproxy.yml
Normal file
5
examples/file/reproxy.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
default:
|
||||
- {route: "^/api/svc1/(.*)", dest: "http://127.0.0.1:8081/api/$1","ping": "http://127.0.0.1:8081/health"}
|
||||
- {route: "/api/svc2", dest: "http://127.0.0.1:8082/api", "ping": "http://127.0.0.1:8082/health"}
|
||||
localhost:
|
||||
- {route: "^/api/svc3/(.*)", dest: "http://localhost:8083/$1","ping": "http://127.0.0.1:8083/health"}
|
||||
Reference in New Issue
Block a user