Skip to content

Commit f3bccbe

Browse files
committed
Render router upstream hosts from environment
1 parent a25bd76 commit f3bccbe

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

services/router/docker-entrypoint.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,52 @@ set -eu
33

44
CERT_FILE="${TLS_CERT_FILE:-/etc/nginx/certs/tls.crt}"
55
KEY_FILE="${TLS_KEY_FILE:-/etc/nginx/certs/tls.key}"
6+
JOURNAL_HOST="${ROUTER_JOURNAL_HOST:-journal}"
7+
GATEWAY_HOST="${ROUTER_GATEWAY_HOST:-gateway}"
8+
EXPLORER_HOST="${ROUTER_EXPLORER_HOST:-explorer}"
9+
WORKBENCH_HOST="${ROUTER_WORKBENCH_HOST:-workbench}"
10+
11+
cat > /etc/nginx/includes/nginx.routes.inc <<EOF
12+
location /interface {
13+
proxy_pass http://${JOURNAL_HOST}/interface;
14+
}
15+
16+
location = /gateway {
17+
return 301 /gateway/;
18+
}
19+
20+
location /gateway/ {
21+
proxy_pass http://${GATEWAY_HOST}/;
22+
}
23+
24+
location /api/ {
25+
proxy_pass http://${GATEWAY_HOST};
26+
}
27+
28+
location = /docs {
29+
proxy_pass http://${GATEWAY_HOST}/docs;
30+
}
31+
32+
location = /api/v1/docs {
33+
proxy_pass http://${GATEWAY_HOST}/api/v1/docs;
34+
}
35+
36+
location = /healthz {
37+
proxy_pass http://${GATEWAY_HOST}/healthz;
38+
}
39+
40+
location = /readyz {
41+
proxy_pass http://${GATEWAY_HOST}/readyz;
42+
}
43+
44+
location /explorer {
45+
proxy_pass http://${EXPLORER_HOST}/;
46+
}
47+
48+
location /workbench {
49+
proxy_pass http://${WORKBENCH_HOST}/;
50+
}
51+
EOF
652

753
if [ -f "$CERT_FILE" ] \
854
&& [ -f "$KEY_FILE" ] \

0 commit comments

Comments
 (0)