Skip to content

Commit

Permalink
Skip token/prefix config check for non-JSON setups
Browse files Browse the repository at this point in the history
This should fix non-JSON (postgres) setups so they can start again. Sorry about that.
  • Loading branch information
PhasecoreX committed Dec 17, 2024
1 parent b4ce062 commit 6ed1788
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions root/app/functions/main-loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Expand Down

0 comments on commit 6ed1788

Please sign in to comment.