From 9f123bb25801927fdcda4cae1ec2db93854c4eda Mon Sep 17 00:00:00 2001 From: Leopere Date: Sun, 11 Nov 2018 21:37:39 -0500 Subject: [PATCH] Simplified feedback Strings were expanding at the wrong location. --- chainquery/stuff/start.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/chainquery/stuff/start.sh b/chainquery/stuff/start.sh index 4b85bcc..0c04ca8 100755 --- a/chainquery/stuff/start.sh +++ b/chainquery/stuff/start.sh @@ -3,15 +3,20 @@ ## Config setup ## Setup Values -DEBUGMODE=${DEBUGMODE:-false} -LBRYCRDURL="rpc://${RPC_USER:-lbryrpc}:${RPC_PASSWORD:-changeme}@10.5.1.2:9245" -MYSQLDSN="${MYSQL_USER:-changeme}:${MYSQL_PASSWORD:-changeme}@tcp(${MYSQL_SERVER:-10.5.1.10}:3306)/${MYSQL_DATABASE:-chainquery}" -APIMYSQLDSN="${MYSQL_USER:-changeme}:${MYSQL_PASSWORD:-changeme}@tcp(${MYSQL_SERVER:-10.5.1.10}:3306)/${MYSQL_DATABASE:-chainquery}" +echo FINDME +DEBUGMODE=$(echo "debugquerymode=${DEBUGMODE:-false}") +echo $DEBUGMODE +LBRYCRDURL=$(echo "rpc://${RPC_USER:-lbryrpc}:${RPC_PASSWORD:-changeme}@10.5.1.2:9245") +echo $LBRYCRDURL +MYSQLDSN=$(echo "${MYSQL_USER:-chainquery}:${MYSQL_PASSWORD:-changeme}@tcp(${MYSQL_SERVER:-10.5.1.10}:3306)/${MYSQL_DATABASE:-chainquery}") +echo $MYSQLDSN +APIMYSQLDSN=$(echo "${MYSQL_USER:-chainquery}:${MYSQL_PASSWORD:-changeme}@tcp(${MYSQL_SERVER:-10.5.1.10}:3306)/${MYSQL_DATABASE:-chainquery}") +echo $APIMYSQLDSN ## Setup Defaults DEBUGMODE_DEFAULT='#DEFAULT-debugquerymode=false' LBRYCRDURL_DEFAULT='#DEFAULT-lbrycrdurl="rpc://lbry:lbry@localhost:9245"' -MYSQLDSN_EFAULT='#DEFAULT-mysqldsn="lbry:lbry@tcp(localhost:3306)/chainquery"' +MYSQLDSN_DEFAULT='#DEFAULT-mysqldsn="lbry:lbry@tcp(localhost:3306)/chainquery"' APIMYSQLDSN_DEFAULT='#DEFAULT-apihostport="0.0.0.0:6300"' ## Add setup value variable name to this list to get processed on container start @@ -29,15 +34,20 @@ function set_configs() { eval FROM_STRING=\$"${CONFIG_SETTINGS[$i]}_DEFAULT" eval TO_STRING=\$${CONFIG_SETTINGS[$i]} ## TODO: Add a bit more magic to make sure that you're only configuring things if not set by config mounts. - sed -i '' "s~$FROM_STRING~$TO_STRING~g" /etc/chainquery/chainqueryconfig.toml + sed -i "s~$FROM_STRING~"$TO_STRING"~g" /etc/chainquery/chainqueryconfig.toml done + echo "Reading config for debugging." + cat /etc/chainquery/chainqueryconfig.toml } if [[ ! -f /etc/chainquery/chainqueryconfig.toml ]]; then - echo "[INFO]: Found no chainqueryconfig.toml" + echo "[INFO]: Did not find chainqueryconfig.toml" echo " Installing default and configuring with provided environment variables if any." ## Install fresh copy of config file. - cp /etc/chainquery/chainqueryconfig.toml.orig /etc/chainquery/chainqueryconfig.toml + echo "cp -v /etc/chainquery/chainqueryconfig.toml.orig /etc/chainquery/chainqueryconfig.toml" + cp -v /etc/chainquery/chainqueryconfig.toml.orig /etc/chainquery/chainqueryconfig.toml + chmod 755 /etc/chainquery/chainqueryconfig.toml + ls -lAh /etc/chainquery/ set_configs else echo "[INFO]: Found a copy of chainqueryconfig.toml in /etc/chainquery"