summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-05-11 16:10:55 -0600
committermo khan <mo@mokhan.ca>2025-05-11 21:21:38 -0600
commit9a6492645993b32a86e23d2bc432e43187ec579c (patch)
tree03d8017237fd28e92fb108fca516cb51750e3655
parent2122cfe75bb89f0c0713859009ba81d784924d99 (diff)
chore: update startup script to work for gdk.test:3000
-rw-r--r--start.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/start.sh b/start.sh
index f6e1253..e685939 100644
--- a/start.sh
+++ b/start.sh
@@ -4,9 +4,18 @@ set -e
[ -z "$DEBUG" ] || set -x
+oidc_scheme=$(echo "$OIDC_ISSUER" | awk -F[/:] '{print $1}')
oidc_host=$(echo "$OIDC_ISSUER" | awk -F[/:] '{print $4}')
-yaml=$(sed "s/OAUTH_CLIENT_ID/$OAUTH_CLIENT_ID/" /etc/envoy/envoy.yaml)
-yaml=$(echo "$yaml" | sed "s/example.com/$oidc_host/")
+yaml=$(sed -e "s/OAUTH_CLIENT_ID/$OAUTH_CLIENT_ID/" /etc/envoy/envoy.yaml)
+yaml=$(echo "$yaml" | sed -e "s,https://example.com,$OIDC_ISSUER,")
+yaml=$(echo "$yaml" | sed -e "s/example.com/$oidc_host/")
+
+# For http://gdk.test:3000
+if [ "$oidc_scheme" = "http" ]; then
+ yaml=$(echo "$yaml" | sed -e '/transport_socket:/,+4d')
+ oidc_port=$(echo "$OIDC_ISSUER" | awk -F[/:] '{print $5}')
+ yaml=$(echo "$yaml" | sed -e "s/port_value: 443/port_value: $oidc_port/")
+fi
echo "[$(date "+%H:%M:%S")] ==> Starting…"
/usr/local/bin/sparkled & /usr/local/bin/envoy --config-yaml "$yaml" --component-log-level oauth2:trace