From 6ed178883ce024cfcac4b48c510070a380db8bd8 Mon Sep 17 00:00:00 2001 From: PhasecoreX Date: Tue, 17 Dec 2024 18:55:29 -0500 Subject: [PATCH] Skip token/prefix config check for non-JSON setups This should fix non-JSON (postgres) setups so they can start again. Sorry about that. --- root/app/functions/main-loop.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/root/app/functions/main-loop.sh b/root/app/functions/main-loop.sh index d7ae68a..1cf4444 100755 --- a/root/app/functions/main-loop.sh +++ b/root/app/functions/main-loop.sh @@ -40,15 +40,18 @@ while [ "${RETURN_CODE}" -eq 26 ]; do . /app/functions/configure-redbot.sh fi - # Make sure token and prefix are configured - if [ ! -f "/data/core/settings.json" ] || ! jq -e '."0".GLOBAL.token' /data/core/settings.json > /dev/null || ! jq -e '."0".GLOBAL.prefix' /data/core/settings.json > /dev/null; then - echo "" - echo "ERROR" - echo "The configuration file is missing the bot token and/or prefix." - echo "If this is the first time you are running the bot, make sure" - echo "you specify the \"TOKEN\" and \"PREFIX\" environment variables" - echo "(you can remove them after successfully running the bot once)" - exit 1 + # For default JSON setup... + if [ "$(jq -r .docker.STORAGE_TYPE /data/config.json | tr '[:upper:]' '[:lower:]')" = "json" ]; then + # ...make sure token and prefix are configured + if [ ! -f "/data/core/settings.json" ] || ! jq -e '."0".GLOBAL.token' /data/core/settings.json > /dev/null || ! jq -e '."0".GLOBAL.prefix' /data/core/settings.json > /dev/null; then + echo "" + echo "ERROR" + echo "The configuration file is missing the bot token and/or prefix." + echo "If this is the first time you are running the bot, make sure" + echo "you specify the \"TOKEN\" and \"PREFIX\" environment variables" + echo "(you can remove them after successfully running the bot once)" + exit 1 + fi fi echo "Starting Red-DiscordBot!"