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

include mail password when getting enode with get_enode.sh #1811

Merged
merged 2 commits into from
Feb 5, 2020
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
5 changes: 4 additions & 1 deletion _assets/compose/mailserver/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export MAIL_PASSWORD ?= status-offline-inbox
# Necessary to make mailserver available publicly
export PUBLIC_IP ?= $(shell curl -s https://ipecho.net/plain)

all: checks start show info enode
all: checks start show info enode enode-qr

checks:
ifeq (, $(shell which docker))
Expand Down Expand Up @@ -52,6 +52,9 @@ logs:
enode:
@$(GIT_ROOT)/_assets/scripts/get_enode.sh

enode-qr:
@$(GIT_ROOT)/_assets/scripts/get_enode.sh --qr

config:
@$(GIT_ROOT)/_assets/scripts/gen_config.sh

Expand Down
1 change: 1 addition & 0 deletions _assets/compose/mailserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ To simply start a container run `make`, other commands include:
* `make logs` - Shows you logs of the container.
* `make config` - Creates `${DATA_PATH}/config.json` with your Public IP.
* `make enode` - Shows `enode://` address of the container.
* `make enode-qr` - Shows `enode://` address using a QR code.

# Settings

Expand Down
18 changes: 16 additions & 2 deletions _assets/scripts/get_enode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ RPC_PORT="${RPC_PORT:-8545}"
if [[ -z "${PUBLIC_IP}" ]]; then
PUBLIC_IP=$(curl -s https://ipecho.net/plain)
fi
# Necessary for enode address for Status app
MAIL_PASSWORD="${MAIL_PASSWORD:-status-offline-inbox}"

# query local
RESP_JSON=$(
Expand All @@ -23,5 +25,17 @@ ENODE_RAW=$(echo "${RESP_JSON}" | jq -r '.result.enode')
# drop arguments at the end of enode address
ENODE_CLEAN=$(echo "${ENODE_RAW}" | grep -oP '\Kenode://[^?]+')

# replace localhost with public IP
echo "${ENODE_CLEAN}" | sed s/127.0.0.1/${PUBLIC_IP}/
# replace localhost with public IP and add mail password
ENODE=$(echo "${ENODE_CLEAN}" | sed \
-e "s/127.0.0.1/${PUBLIC_IP}/" \
-e "s/@/:${MAIL_PASSWORD}@/")

if [[ "$1" == "--qr" ]]; then
if ! [ -x "$(command -v qrencode)" ]; then
echo 'Install 'qrencode' for enode QR code.' >&2
exit 0
fi
qrencode -t UTF8 "${ENODE}"
else
echo "${ENODE}"
fi
5 changes: 4 additions & 1 deletion _assets/systemd/mailserver/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $(shell $(GIT_ROOT)/_assets/scripts/get_enode.sh 2>/dev/null)
endef
export INFO_MSG

all: checks build config service enable restart info
all: checks build config service enable restart info enode-qr

clean: stop disable rm-service forget

Expand All @@ -62,6 +62,9 @@ info:
enode:
@$(GIT_ROOT)/_assets/scripts/get_enode.sh

enode-qr:
@$(GIT_ROOT)/_assets/scripts/get_enode.sh --qr

status:
systemctl $(SCTL_OPTS) status --no-pager $(SERVICE_NAME)

Expand Down
1 change: 1 addition & 0 deletions _assets/systemd/mailserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ In order to manage the new `statusd` service you use other `Makefile` targets:

* `make info` - Info about service
* `make enode` - Get enode address
* `make enode-qr` - Get enode address as QR code
* `make start` - Start the service
* `make stop` - Stop the service
* `make status` - Check service status
Expand Down