#!/bin/bash set -exu -o pipefail if [ "$#" -ne 5 ]; then echo "Usage: ./zprox localport grpcaddr grpcport assetsaddr assetsport" echo "localport: the port envoy proxy should listen" echo "grpcaddr, grpcport: the addr+port of the gRPC service" echo "assetsaddr, assetsport: the ip+port of the web server serving zpages assets (html, js, etc)" exit 1 fi TEMP=$(mktemp --suffix=.yaml) function finish { rm "$TEMP" } trap finish EXIT readonly LOCAL_PORT=$1 readonly GRPC_ADDR=$2 readonly GRPC_PORT=$3 readonly ASSETS_ADDR=$4 readonly ASSETS_PORT=$5 readonly GDEBUG_TOKEN_NAME="gdebug-xsrf-token" cat > "$TEMP" <