aboutsummaryrefslogtreecommitdiff
path: root/services/docker/v2ray/v2ray-wrapper.sh
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-03-09 17:31:21 +0800
committerYuqian Yang <crupest@crupest.life>2025-03-09 18:46:54 +0800
commitac7c3e0ab3b460a5a96df04496e6f310ef9572d0 (patch)
tree712d9f164db7623498a97b3778e2322c5d4a9752 /services/docker/v2ray/v2ray-wrapper.sh
parent4915c92a8ff30439676cb328864acab050538f37 (diff)
downloadcrupest-ac7c3e0ab3b460a5a96df04496e6f310ef9572d0.tar.gz
crupest-ac7c3e0ab3b460a5a96df04496e6f310ef9572d0.tar.bz2
crupest-ac7c3e0ab3b460a5a96df04496e6f310ef9572d0.zip
feat(service): mv config to docker imagei, better pri/pub git.
Diffstat (limited to 'services/docker/v2ray/v2ray-wrapper.sh')
-rwxr-xr-xservices/docker/v2ray/v2ray-wrapper.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/services/docker/v2ray/v2ray-wrapper.sh b/services/docker/v2ray/v2ray-wrapper.sh
new file mode 100755
index 0000000..3887a0e
--- /dev/null
+++ b/services/docker/v2ray/v2ray-wrapper.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -e
+
+die() {
+ echo "$@" >&2
+ exit 1
+}
+
+[ -n "$CRUPEST_V2RAY_TOKEN" ] || die "CRUPEST_V2RAY_TOKEN is not set. It is used as password of v2ray tunnel."
+[ -n "$CRUPEST_V2RAY_PATH" ] || die "CRUPEST_V2RAY_PATH is not set. It is used as the http endpoint."
+
+sed -e "s|@@CRUPEST_V2RAY_TOKEN@@|$CRUPEST_V2RAY_TOKEN|" \
+ -e "s|@@CRUPEST_V2RAY_PATH@@|$CRUPEST_V2RAY_PATH|" \
+ "/app/config.json.template" > /app/config.json
+
+exec /usr/bin/v2ray run -c /app/config.json