Simplified feedback

Strings were expanding at the wrong location.
This commit is contained in:
Leopere 2018-11-11 21:37:39 -05:00 committed by Mark Beamer Jr
parent 23e0688383
commit 9f123bb258
No known key found for this signature in database
GPG key ID: 1C314FB89AD76973

View file

@ -3,15 +3,20 @@
## Config setup ## Config setup
## Setup Values ## Setup Values
DEBUGMODE=${DEBUGMODE:-false} echo FINDME
LBRYCRDURL="rpc://${RPC_USER:-lbryrpc}:${RPC_PASSWORD:-changeme}@10.5.1.2:9245" DEBUGMODE=$(echo "debugquerymode=${DEBUGMODE:-false}")
MYSQLDSN="${MYSQL_USER:-changeme}:${MYSQL_PASSWORD:-changeme}@tcp(${MYSQL_SERVER:-10.5.1.10}:3306)/${MYSQL_DATABASE:-chainquery}" echo $DEBUGMODE
APIMYSQLDSN="${MYSQL_USER:-changeme}:${MYSQL_PASSWORD:-changeme}@tcp(${MYSQL_SERVER:-10.5.1.10}:3306)/${MYSQL_DATABASE:-chainquery}" 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 ## Setup Defaults
DEBUGMODE_DEFAULT='#DEFAULT-debugquerymode=false' DEBUGMODE_DEFAULT='#DEFAULT-debugquerymode=false'
LBRYCRDURL_DEFAULT='#DEFAULT-lbrycrdurl="rpc://lbry:lbry@localhost:9245"' 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"' APIMYSQLDSN_DEFAULT='#DEFAULT-apihostport="0.0.0.0:6300"'
## Add setup value variable name to this list to get processed on container start ## 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 FROM_STRING=\$"${CONFIG_SETTINGS[$i]}_DEFAULT"
eval TO_STRING=\$${CONFIG_SETTINGS[$i]} 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. ## 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 done
echo "Reading config for debugging."
cat /etc/chainquery/chainqueryconfig.toml
} }
if [[ ! -f /etc/chainquery/chainqueryconfig.toml ]]; then 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." echo " Installing default and configuring with provided environment variables if any."
## Install fresh copy of config file. ## 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 set_configs
else else
echo "[INFO]: Found a copy of chainqueryconfig.toml in /etc/chainquery" echo "[INFO]: Found a copy of chainqueryconfig.toml in /etc/chainquery"