Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add tor entrypoint script for use in dashmate #4182

Merged
merged 5 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docker/Dockerfile.GitHubActions
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ USER dash

VOLUME ["/dash"]

COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

EXPOSE 9998 9999 19998 19999

WORKDIR /dash
21 changes: 21 additions & 0 deletions docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

export LC_ALL=C
set -e
UdjinM6 marked this conversation as resolved.
Show resolved Hide resolved

# Get Tor service IP if running
if [[ "$1" == "dashd" ]]; then
# Because dashd only accept torcontrol= host as an ip only, we resolve it here and add to config
if [[ "$TOR_CONTROL_HOST" ]] && [[ "$TOR_CONTROL_PORT" ]] && [[ "$TOR_PROXY_PORT" ]]; then
TOR_IP=$(getent hosts $TOR_CONTROL_HOST | cut -d ' ' -f 1)
echo "proxy=$TOR_IP:$TOR_PROXY_PORT" >> "$HOME/.dashcore/dash.conf"
echo "Added "proxy=$TOR_IP:$TOR_PROXY_PORT" to $HOME/.dashcore/dash.conf"
echo "torcontrol=$TOR_IP:$TOR_CONTROL_PORT" >> "$HOME/.dashcore/dash.conf"
echo "Added "torcontrol=$TOR_IP:$TOR_CONTROL_PORT" to $HOME/.dashcore/dash.conf"
echo -e "\n"
else
echo "Tor control credentials not provided"
fi
fi

exec "$@"