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

chore: remove xud.conf #722

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
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.$(date +%s).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