From cd9bcb8c13dd473ceeafb01a47ec7c79d9f5a395 Mon Sep 17 00:00:00 2001 From: status404 Date: Fri, 21 Apr 2023 14:20:58 +0500 Subject: [PATCH] Dockerfile add jq --- docker/Dockerfile | 2 +- docker/README.md | 4 +++- docker/entrypoint.sh | 12 ++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ddfc004..37b7385 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,7 +19,7 @@ ARG DEBIAN_FRONTEND="noninteractive" \ DEBCONF_NOWARNINGS="yes" RUN apt-get update -y ; \ apt-get upgrade -y ; \ - apt-get -y install --no-install-recommends locales ; \ + apt-get -y install --no-install-recommends locales jq moreutils; \ apt-get -y install --no-install-recommends gpg gpg-agent ; \ apt-get -y install --no-install-recommends nginx ; \ apt-get -y install --no-install-recommends openssl ca-certificates ; \ diff --git a/docker/README.md b/docker/README.md index 7554f55..8874a72 100644 --- a/docker/README.md +++ b/docker/README.md @@ -7,10 +7,12 @@ Deal Module (dm) - the Bitdeals daemon that provides a special interfaces for cr # Running DM docker container -On first run the initialization script will create (if it is empty), a new bitcoin and PGP keys and start the daemon. +On first run the initialization script will create, a new bitcoin and PGP keys and start the daemon. Daemon settings may specified by an environment variables. PGP secret key is stored on a Docker volume. +First run example: `docker run -i -t -e DM_TESTNET=1 -p 127.0.0.1:443:443 bitdeals/apostol-dm` - register new user, open WebUI port. + # Usage Here are some example snippets to help you get started creating a container at localhost. diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 0fad5cc..7475b0b 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -53,11 +53,12 @@ fi export LC_ALL="$DM_LC_ALL" ## Add DM_FORWEB to dm oauth config -if ! grep -q "$(basename $DM_FORWEB)" $WEB_CONF_SITES; then - sed -i "/\"hosts\":/ s|]|, \"$(basename $DM_FORWEB)\"]|" $WEB_CONF_SITES - sed -i -e "/\"redirect_uris\":/ s|$|\n\t\"$DM_FORWEB/oauth2/callback\",|" \ - -e "/\"redirect_uris\":/ s|$|\n\t\"$DM_FORWEB/oauth2/code\",|" $WEB_CONF_OAUTH -fi +cat $WEB_CONF_OAUTH | \ + jq --arg host "$DM_FORWEB" '.web | .redirect_uris=[$host+"/oauth2/code",$host+"/oauth2/callback"]' | \ + sponge $WEB_CONF_OAUTH +cat $WEB_CONF_SITES | \ + jq --arg host "$(basename $DM_FORWEB)" '.hosts = [$host]' | \ + sponge $WEB_CONF_SITES ## Write the PGP keys locations to dm config sed -i "/\[pgp\]/,/\[/ s%^private=.*%private=$PGP_SEC_FILE%" $CONF_FILES @@ -175,7 +176,6 @@ then tee -a $BITCOIN_KEYS_BACKUP <<-EOF ${B}Please backup this BITCOIN KEY:${N} - Private key (raw form): $PRIVKEY Private key (WIF form): $PRIVKEYWIF Public key: $PUBKEY Bitcoin address: $BITCOIN