#!/bin/sh export BITMESSAGE_API_USER="${BITMESSAGE_API_USER:-bitmessage_api_user}" export BITMESSAGE_API_PASSWORD="${BITMESSAGE_API_PASSWORD:-bitmessage_api_password}" export BITMESSAGE_SEED_ADDRESSES="${BITMESSAGE_SEED_ADDRESSES:-0}" export BITMESSAGE_API_PORT="${BITMESSAGE_API_PORT:-8442}" export BITMESSAGE_TTL="${BITMESSAGE_TTL:-172800}" export BITMESSAGE_STOPRESENDINGAFTERXDAYS="${BITMESSAGE_STOPRESENDINGAFTERXDAYS:-30}" export BITMESSAGE_APIVARIANT="${BITMESSAGE_APIVARIANT:-legacy}" if [ -z "$BITMESSAGE_SEED_PHRASE" ] then BITMESSAGE_SEED_PHRASE="$(cat /dev/random | tr -dc "a-z" | head -c32)" export BITMESSAGE_SEED_PHRASE fi # this command must be run as root (for bind mounts to container) chown bitmessage:bitmessage keys.dat chmod 600 keys.dat # set config values gosu bitmessage sed -i -e "s|\(apiinterface = \).*|\10\.0\.0\.0|g" \ -e "s|\(apivariant = \).*|\1$BITMESSAGE_APIVARIANT|g" \ -e "s|\(apiusername = \).*|\1$BITMESSAGE_API_USER|g" \ -e "s|\(apipassword = \).*|\1$BITMESSAGE_API_PASSWORD|g" \ -e "s|\(apiport = \).*|\1$BITMESSAGE_API_PORT|g" \ -e "s|\(apienabled = \).*|\1True|g" \ -e "s|\(ttl = \).*|\1$BITMESSAGE_TTL|g" \ -e "s|\(stopresendingafterxdays = \).*|\1$BITMESSAGE_STOPRESENDINGAFTERXDAYS|g" \ -e "s|\(udp = \).*|\1False|g" keys.dat # generate address from seed test "$BITMESSAGE_SEED_ADDRESSES" -gt 0 && for i in {1..4} do sleep 15 gosu bitmessage /usr/bin/python /usr/local/bin/seed_addr_gen.py done & exec gosu bitmessage pybitmessage -d