WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 61b5600

Browse files
committed
chore: allowed options to pass port
1 parent ad0eb45 commit 61b5600

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

container_run.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ DEFAULT_ALLOWED_ORIGINS="*"
66
DEFAULT_BANNED_OUTPUTS=""
77
DEFAULT_BANNED_DESTS=""
88

9-
# Proxyscotch container allows configurations through env variables
10-
# in PROXYSCOTCH_TOKEN, PROXYSCOTCH_ALLOWED_ORIGINS,
11-
# PROXYSCOTCH_BANNED_OUTPUTS and PROXYSCOTCH_BANNED_DESTS
9+
# Read PORT from Cloud Run environment or default to 9159
10+
PORT="${PORT:-9159}"
11+
HOST_ARG="--host=0.0.0.0:${PORT}"
1212

13-
# This is hardcoded
14-
HOST_ARG="--host=0.0.0.0:9159"
13+
echo "Starting Proxyscotch on port ${PORT}"
1514

1615
# Process token (only add if env var is set or default is not blank)
1716
TOKEN_ARG=""
@@ -21,8 +20,10 @@ elif [ -n "${DEFAULT_TOKEN}" ]; then
2120
TOKEN_ARG="--token=${DEFAULT_TOKEN}"
2221
fi
2322

24-
# Process allowed-origins
25-
if [ -n "${PROXYSCOTCH_ALLOWED_ORIGINS}" ]; then
23+
# Process allowed-origins - Support both ALLOWED_ORIGINS and PROXYSCOTCH_ALLOWED_ORIGINS
24+
if [ -n "${ALLOWED_ORIGINS}" ]; then
25+
ORIGINS_ARG="--allowed-origins=${ALLOWED_ORIGINS}"
26+
elif [ -n "${PROXYSCOTCH_ALLOWED_ORIGINS}" ]; then
2627
ORIGINS_ARG="--allowed-origins=${PROXYSCOTCH_ALLOWED_ORIGINS}"
2728
else
2829
ORIGINS_ARG="--allowed-origins=${DEFAULT_ALLOWED_ORIGINS}"

0 commit comments

Comments
 (0)