testnet-laconicd-stack/stack-orchestrator/config/laconic-faucet/start-faucet.sh

31 lines
961 B
Bash
Raw Permalink Normal View History

#!/bin/bash
set -e
set -u
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
config_template=$(cat environments/config-template.toml)
target_config="./environments/local.toml"
# Check if faucet key is set
if [ -z "${CERC_FAUCET_KEY:-}" ]; then
echo "Error: CERC_FAUCET_KEY is not set. Exiting..."
exit 1
fi
echo "Using laconicd RPC endpoint: $CERC_LACONICD_RPC_ENDPOINT"
echo "Transfer amount per request: $CERC_TRANSFER_AMOUNT"
echo "Transfer limit for an address within a period: $CERC_PERIOD_TRANSFER_LIMIT"
FAUCET_CONFIG=$(echo "$config_template" | \
sed -E "s|REPLACE_WITH_CERC_FAUCET_KEY|${CERC_FAUCET_KEY}|g; \
s|REPLACE_WITH_CERC_LACONICD_RPC_ENDPOINT|${CERC_LACONICD_RPC_ENDPOINT}|g; \
s|REPLACE_WITH_CERC_TRANSFER_AMOUNT|${CERC_TRANSFER_AMOUNT}|g; \
s|REPLACE_WITH_CERC_PERIOD_TRANSFER_LIMIT|${CERC_PERIOD_TRANSFER_LIMIT}|; ")
echo "$FAUCET_CONFIG" > $target_config
echo "Starting faucet..."
node dist/index.js