Skip to content

Commit

Permalink
chore: remove xud.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
reliveyy committed Sep 15, 2020
1 parent 2636c0d commit 4325823
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 42 deletions.
11 changes: 1 addition & 10 deletions images/utils/launcher/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,6 @@ def parse_command_line_arguments(self):
metavar="<ports>",
help="Expose xud service ports to your host machine"
)
group.add_argument(
"--xud.preserve-config",
action="store_true",
help="Preserve xud xud.conf file during updates"
)

group = parser.add_argument_group("arby")
group.add_argument(
Expand Down Expand Up @@ -656,7 +651,7 @@ def update_disabled(self, node, parsed, opt):

def update_arby(self, parsed):
"""Update arby related configurations from parsed TOML arby section
:param parsed: Parsed xud TOML section
:param parsed: Parsed arby TOML section
"""
node = self.nodes["arby"]
if "test-centralized-baseasset-balance" in parsed:
Expand Down Expand Up @@ -815,10 +810,6 @@ def parse_network_config(self):
except FileNotFoundError:
pass

if hasattr(self.args, "xud.preserve_config"):
if "xud" in self.nodes:
self.nodes["xud"]["preserve_config"] = True

if hasattr(self.args, "lndbtc.preserve_config"):
if "lndbtc" in self.nodes:
self.nodes["lndbtc"]["preserve_config"] = True
Expand Down
3 changes: 3 additions & 0 deletions images/utils/launcher/node/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ def __init__(self, name: str, ctx):

def generate_environment(self):
environment = [f"NETWORK={self.network}"]

# TODO deprecate PRESERVE_CONFIG
if self.node_config["preserve_config"]:
environment.append("PRESERVE_CONFIG=true")
else:
environment.append("PRESERVE_CONFIG=false")

return environment

def generate_volumes(self):
Expand Down
60 changes: 29 additions & 31 deletions images/xud/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,37 +76,35 @@ while [[ ! -e /root/.lndltc/tls.cert ]]; do
sleep 1
done


[[ -e $XUD_CONF && $PRESERVE_CONFIG == "true" ]] || {
cp /app/sample-xud.conf $XUD_CONF

sed -i "s/network.*/network = \"$NETWORK\"/" $XUD_CONF
sed -i 's/noencrypt.*/noencrypt = false/' $XUD_CONF
sed -i '/\[http/,/^$/s/host.*/host = "0.0.0.0"/' $XUD_CONF
sed -i "/\[http/,/^$/s/port.*/port = $HTTP_PORT/" $XUD_CONF
sed -i '/\[lnd\.BTC/,/^$/s/host.*/host = "lndbtc"/' $XUD_CONF
sed -i "/\[lnd\.BTC/,/^$/s|^$|certpath = \"/root/.lndbtc/tls.cert\"\nmacaroonpath = \"/root/.lndbtc/data/chain/bitcoin/$NETWORK/admin.macaroon\"\n|" $XUD_CONF
sed -i '/\[lnd\.LTC/,/^$/s/host.*/host = "lndltc"/' $XUD_CONF
sed -i '/\[lnd\.LTC/,/^$/s/port.*/port = 10009/' $XUD_CONF
sed -i "/\[lnd\.LTC/,/^$/s|^$|certpath = \"/root/.lndltc/tls.cert\"\nmacaroonpath = \"/root/.lndltc/data/chain/litecoin/$NETWORK/admin.macaroon\"\n|" $XUD_CONF
sed -i "/\[p2p/,/^$/s/addresses.*/addresses = \[\"$XUD_ADDRESS\"]/" $XUD_CONF
sed -i "/\[p2p/,/^$/s/port.*/port = $P2P_PORT/" $XUD_CONF
sed -i '/\[p2p/,/^$/s/tor = .*/tor = true/' $XUD_CONF
sed -i '/\[p2p/,/^$/s/torport.*/torport = 9050/' $XUD_CONF
sed -i '/\[raiden/,/^$/s/disable.*/disable = true/' $XUD_CONF
sed -i '/\[rpc/,/^$/s/host.*/host = "0.0.0.0"/' $XUD_CONF
sed -i "/\[rpc/,/^$/s/port.*/port = $RPC_PORT/" $XUD_CONF
sed -i '/\[connext/,/^$/s/disable.*/disable = false/' $XUD_CONF
sed -i '/\[connext/,/^$/s/host.*/host = "connext"/' $XUD_CONF
sed -i '/\[connext/,/^$/s/port.*/port = 5040/' $XUD_CONF
sed -i '/\[connext/,/^$/s/webhookhost.*/webhookhost = "xud"/' $XUD_CONF
sed -i "/\[connext/,/^$/s/webhookport.*/webhookport = $HTTP_PORT/" $XUD_CONF
}

echo "[entrypoint] Launch with xud.conf:"
cat $XUD_CONF

/xud-backup.sh &

# for backward compatibility
if [[ -e $XUD_CONF ]]; then
mv "$XUD_CONF" "$XUD_DIR/previous-xud.conf"
fi

# use exec to properly respond to SIGINT
exec xud $@
# shellcheck disable=2068
exec xud \
--network="$NETWORK" \
--noencrypt=false \
--http.host="0.0.0.0" \
--http.port="$HTTP_PORT" \
--lnd.BTC.host="lndbtc" \
--lnd.BTC.certpath="/root/.lndbtc/tls.cert" \
--lnd.BTC.macaroonpath="/root/.lndbtc/data/chain/bitcoin/$NETWORK/admin.macaroon" \
--lnd.LTC.certpath="/root/.lndltc/tls.cert" \
--lnd.LTC.macaroonpath="/root/.lndltc/data/chain/litecoin/$NETWORK/admin.macaroon" \
--p2p.address="$XUD_ADDRESS" \
--p2p.port="$P2P_PORT" \
--p2p.tor=true \
--p2p.torport=9050 \
--raiden.disable=true \
--rpc.host="0.0.0.0" \
--rpc.port="$RPC_PORT" \
--connext.disable=false \
--connext.host="connext" \
--connext.port=5040 \
--connext.webhookhost="xud" \
--connext.webhookport="$HTTP_PORT" \
$@
1 change: 0 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ Connext options:
Xud options:
--xud.expose-ports <port>[,<port>] Expose xud service ports to your host machine
--xud.preserve-config Preserve xud xud.conf file during updates
Arby options:
--arby.live-cex [true|false] Production/Demo mode (default: false)
Expand Down

0 comments on commit 4325823

Please sign in to comment.