Multiple static location (#36)

* add isStatic flag to mapper, implement for file and static providers

* handle static match response as a special case

* move assets conversion to load time

* rename static to assets everywhere for consistency

* don't overwride asset param in url mapper

* add documentation about assets mode

* add tests
This commit is contained in:
Umputun
2021-04-16 02:49:00 -05:00
committed by GitHub
parent 33346c9f7a
commit 8cf4b9063d
17 changed files with 402 additions and 94 deletions

View File

@@ -1,18 +1,17 @@
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 --assets.location=./web --assets.root=/static
pkill -9 whoami
echo-http --listen=0.0.0.0:8081 --message=svc1 &
echo-http --listen=0.0.0.0:8082 --message=svc2 &
echo-http --listen=0.0.0.0:8083 --message=svc3 &
../../dist/reproxy --file.enabled --file.name=reproxy.yml --assets.location=./web --assets.root=/static --dbg --logger.stdout
pkill -9 echo-http
run_assets_only: install
../../dist/reproxy --assets.location=./web --assets.root=/
pkill -9 whoami
pkill -9 echo-http
kill:
pkill -9 whoami
pkill -9 echo-http
install:
cd ../../app && CGO_ENABLED=0 go build -o ../dist/reproxy
cd /tmp && go install github.com/traefik/whoami@latest
cd /tmp && go install github.com/umputun/echo-http@latest

View File

@@ -3,3 +3,4 @@ default:
- {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"}
- {route: "/www", dest: "web2", "static": y}

View File

@@ -0,0 +1 @@
1.html web2

View File

@@ -0,0 +1 @@
index web2