Created
October 7, 2019 17:50
-
-
Save dangarthwaite/fc3ad01b29bd75387836e3c16cd21c9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Override defaults with environment variables | |
CONFIGFILE="${CONFIGFILE:-/etc/lbry/chainqueryconfig.toml}" | |
DEBUGMODE="${DEBUGMODE:-false}" | |
RPC_USER="${RPC_USER:-lbry}" | |
RPC_PASSWORD="${RPC_PASSWORD:-lbry}" | |
RPC_HOST="${RPC_HOST:-localhost}" | |
MYSQL_SERVER="${MYSQL_SERVER:-localhost}" | |
MYSQL_USER="${MYSQL_USER:-lbry}" | |
MYSQL_PASSWORD="${MYSQL_PASSWORD:-lbry}" | |
MYSQL_DATABASE="${MYSQL_DATABASE:-chainquery}" | |
exec_chainquery() { | |
CONFIG_DIR=$(dirname "${CONFIGFILE}") | |
exec chainquery serve --configpath "$CONFIG_DIR" | |
} | |
if [[ -f "$CONFIGFILE" ]]; then | |
echo "[INFO]: Found a copy of chainqueryconfig.toml in /etc/lbry" | |
exec_chainquery | |
fi | |
cat << EOF >> "${CONFIGFILE}" | |
DEBUGMODE="${DEBUGMODE}" | |
LBRYCRDURL="rpc://${RPC_USER}:${RPC_PASSWORD}@${RPC_HOST}:9245" | |
MYSQLDSN="${MYSQL_USER}:${MYSQL_PASSWORD}@tcp(${MYSQL_SERVER}:3306)/$MYSQL_DATABASE" | |
APIMYSQLDSN="${MYSQL_USER}:${MYSQL_PASSWORD}@tcp(${MYSQL_SERVER}:3306)/$MYSQL_DATABASE" | |
EOF | |
exec_chainquery |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should be a wire-equivalent replacement of the current stuff/start.sh script.
Next would be to add RPC_PORT since the lbrycrd in RUN_MODE=REG_TEST runs on a nonstandard port.