From 3df870e6cdfbc92e30d9e32c59578ba6f4f8d844 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Tue, 27 Oct 2020 15:20:20 +0100 Subject: [PATCH] Make --enable-horizon-captive-core backwards compatible --- common/horizon/etc/horizon.env | 3 --- start | 11 +++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/common/horizon/etc/horizon.env b/common/horizon/etc/horizon.env index a8795f77..9910ef29 100644 --- a/common/horizon/etc/horizon.env +++ b/common/horizon/etc/horizon.env @@ -12,6 +12,3 @@ export NETWORK_PASSPHRASE="__NETWORK__" export DISABLE_ASSET_STATS="true" export HISTORY_ARCHIVE_URLS="__ARCHIVE__" export ADMIN_PORT=6060 -export ENABLE_CAPTIVE_CORE_INGESTION=__ENABLE_CAPTIVE_CORE__ -export STELLAR_CORE_BINARY_PATH=/usr/bin/stellar-core -export STELLAR_CORE_CONFIG_PATH=/opt/stellar/core/etc/stellar-captive-core.cfg diff --git a/start b/start index 62b7288d..0efa8944 100644 --- a/start +++ b/start @@ -26,7 +26,7 @@ function main() { process_args $* if [ "$NETWORK" != "standalone" ] && [ "$ENABLE_HORIZON_CAPTIVE_CORE" = "true" ]; then echo "--enable-horizon-captive-core is only supported in the standalone network" >&2 - exit 1 + exit 1 fi echo "mode: $STELLAR_MODE" @@ -282,9 +282,16 @@ function init_horizon() { -e "s/__PGPASS__/$PGPASS/g" \ -e "s/__NETWORK__/$NETWORK_PASSPHRASE/g" \ -e "s=__ARCHIVE__=$HISTORY_ARCHIVE_URLS=g" \ - -e "s=__ENABLE_CAPTIVE_CORE__=$ENABLE_HORIZON_CAPTIVE_CORE=g" \ etc/horizon.env + if [ "$ENABLE_HORIZON_CAPTIVE_CORE" = "true" ]; then + cat << EOF >> etc/horizon.env +export ENABLE_CAPTIVE_CORE_INGESTION=true +export STELLAR_CORE_BINARY_PATH=/usr/bin/stellar-core +export STELLAR_CORE_CONFIG_PATH=/opt/stellar/core/etc/stellar-captive-core.cfg +EOF + fi + start_postgres run_silent "init-horizon-db" sudo -u stellar ./bin/horizon db init if [ "$NETWORK" == "standalone" ]; then