add option to show enode as QR code if qrencode is available
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
b476d5c6f3
commit
14501520be
|
@ -18,7 +18,7 @@ export MAIL_PASSWORD ?= status-offline-inbox
|
||||||
# Necessary to make mailserver available publicly
|
# Necessary to make mailserver available publicly
|
||||||
export PUBLIC_IP ?= $(shell curl -s https://ipecho.net/plain)
|
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:
|
checks:
|
||||||
ifeq (, $(shell which docker))
|
ifeq (, $(shell which docker))
|
||||||
|
@ -52,6 +52,9 @@ logs:
|
||||||
enode:
|
enode:
|
||||||
@$(GIT_ROOT)/_assets/scripts/get_enode.sh
|
@$(GIT_ROOT)/_assets/scripts/get_enode.sh
|
||||||
|
|
||||||
|
enode-qr:
|
||||||
|
@$(GIT_ROOT)/_assets/scripts/get_enode.sh --qr
|
||||||
|
|
||||||
config:
|
config:
|
||||||
@$(GIT_ROOT)/_assets/scripts/gen_config.sh
|
@$(GIT_ROOT)/_assets/scripts/gen_config.sh
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ To simply start a container run `make`, other commands include:
|
||||||
* `make logs` - Shows you logs of the container.
|
* `make logs` - Shows you logs of the container.
|
||||||
* `make config` - Creates `${DATA_PATH}/config.json` with your Public IP.
|
* `make config` - Creates `${DATA_PATH}/config.json` with your Public IP.
|
||||||
* `make enode` - Shows `enode://` address of the container.
|
* `make enode` - Shows `enode://` address of the container.
|
||||||
|
* `make enode-qr` - Shows `enode://` address using a QR code.
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,16 @@ ENODE_RAW=$(echo "${RESP_JSON}" | jq -r '.result.enode')
|
||||||
ENODE_CLEAN=$(echo "${ENODE_RAW}" | grep -oP '\Kenode://[^?]+')
|
ENODE_CLEAN=$(echo "${ENODE_RAW}" | grep -oP '\Kenode://[^?]+')
|
||||||
|
|
||||||
# replace localhost with public IP and add mail password
|
# replace localhost with public IP and add mail password
|
||||||
echo "${ENODE_CLEAN}" | sed \
|
ENODE=$(echo "${ENODE_CLEAN}" | sed \
|
||||||
-e "s/127.0.0.1/${PUBLIC_IP}/" \
|
-e "s/127.0.0.1/${PUBLIC_IP}/" \
|
||||||
-e "s/@/:${MAIL_PASSWORD}@/"
|
-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
|
||||||
|
|
|
@ -38,7 +38,7 @@ $(shell $(GIT_ROOT)/_assets/scripts/get_enode.sh 2>/dev/null)
|
||||||
endef
|
endef
|
||||||
export INFO_MSG
|
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
|
clean: stop disable rm-service forget
|
||||||
|
|
||||||
|
@ -62,6 +62,9 @@ info:
|
||||||
enode:
|
enode:
|
||||||
@$(GIT_ROOT)/_assets/scripts/get_enode.sh
|
@$(GIT_ROOT)/_assets/scripts/get_enode.sh
|
||||||
|
|
||||||
|
enode-qr:
|
||||||
|
@$(GIT_ROOT)/_assets/scripts/get_enode.sh --qr
|
||||||
|
|
||||||
status:
|
status:
|
||||||
systemctl $(SCTL_OPTS) status --no-pager $(SERVICE_NAME)
|
systemctl $(SCTL_OPTS) status --no-pager $(SERVICE_NAME)
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ In order to manage the new `statusd` service you use other `Makefile` targets:
|
||||||
|
|
||||||
* `make info` - Info about service
|
* `make info` - Info about service
|
||||||
* `make enode` - Get enode address
|
* `make enode` - Get enode address
|
||||||
|
* `make enode-qr` - Get enode address as QR code
|
||||||
* `make start` - Start the service
|
* `make start` - Start the service
|
||||||
* `make stop` - Stop the service
|
* `make stop` - Stop the service
|
||||||
* `make status` - Check service status
|
* `make status` - Check service status
|
||||||
|
|
Loading…
Reference in New Issue