Skip to content

Commit 96c0418

Browse files
strophyUdjinM6
authored andcommitted
feat: add tor entrypoint script for use in dashmate (#4182)
* feat: add entrypoint for tor features in dashmate * fix: use spaces consistently for indendation * fix: output blank line after info * fix: ensure script is executable * fix: keep linter happy
1 parent 3661f36 commit 96c0418

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

docker/Dockerfile.GitHubActions

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ USER dash
3434

3535
VOLUME ["/dash"]
3636

37+
COPY docker-entrypoint.sh /docker-entrypoint.sh
38+
ENTRYPOINT ["/docker-entrypoint.sh"]
39+
3740
EXPOSE 9998 9999 19998 19999
3841

3942
WORKDIR /dash

docker/docker-entrypoint.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
export LC_ALL=C
4+
set -e
5+
6+
# Get Tor service IP if running
7+
if [[ "$1" == "dashd" ]]; then
8+
# Because dashd only accept torcontrol= host as an ip only, we resolve it here and add to config
9+
if [[ "$TOR_CONTROL_HOST" ]] && [[ "$TOR_CONTROL_PORT" ]] && [[ "$TOR_PROXY_PORT" ]]; then
10+
TOR_IP=$(getent hosts $TOR_CONTROL_HOST | cut -d ' ' -f 1)
11+
echo "proxy=$TOR_IP:$TOR_PROXY_PORT" >> "$HOME/.dashcore/dash.conf"
12+
echo "Added "proxy=$TOR_IP:$TOR_PROXY_PORT" to $HOME/.dashcore/dash.conf"
13+
echo "torcontrol=$TOR_IP:$TOR_CONTROL_PORT" >> "$HOME/.dashcore/dash.conf"
14+
echo "Added "torcontrol=$TOR_IP:$TOR_CONTROL_PORT" to $HOME/.dashcore/dash.conf"
15+
echo -e "\n"
16+
else
17+
echo "Tor control credentials not provided"
18+
fi
19+
fi
20+
21+
exec "$@"

0 commit comments

Comments
 (0)