<commit_before>#!/usr/bin/env bash
set -e
if [ ! "$MONGO_URL" ]; then
    chown -R mongodb:mongodb /var/lib/mongodb
    test -f /var/lib/mongodb/mongod.lock && rm -f $_
    mongod --dbpath=/var/lib/mongodb --smallfiles &
    while true; do
        if mongo --eval "db.stats()" > /dev/null; then
            echo "waiting for mongodb..."
            sleep 2
        else
            break
        fi
    done
fi

# Set env variables if they are not set for further work
if [ -z "$JUST_SITE_NAME" ]; then
    export JUST_SITE_NAME="default"
fi

if [[ -z "$JUST_ADMIN_EMAIL" ]]; then
    export JUST_ADMIN_EMAIL="<EMAIL>"
fi

if [[ -z "$JUST_ADMIN_PASSWORD" ]]; then
    export JUST_ADMIN_PASSWORD="<PASSWORD>"
fi

perl -pi -e 's/{site_name}/'`echo $JUST_SITE_NAME`'/g' mgosites-admin/index.html
<commit_msg>Fix startup mongo availability check logic<commit_after>#!/usr/bin/env bash
set -e
if [ ! "$MONGO_URL" ]; then
    chown -R mongodb:mongodb /var/lib/mongodb
    test -f /var/lib/mongodb/mongod.lock && rm -f $_
    mongod --dbpath=/var/lib/mongodb --smallfiles &
    while true; do
        if mongo --eval "db.stats()" > /dev/null; then
            break
        else
            echo "waiting for mongodb..."
            sleep 2
        fi
    done
fi

# Set env variables if they are not set for further work
if [ -z "$JUST_SITE_NAME" ]; then
    export JUST_SITE_NAME="default"
fi

if [[ -z "$JUST_ADMIN_EMAIL" ]]; then
    export JUST_ADMIN_EMAIL="<EMAIL>"
fi

if [[ -z "$JUST_ADMIN_PASSWORD" ]]; then
    export JUST_ADMIN_PASSWORD="<PASSWORD>"
fi

perl -pi -e 's/{site_name}/'`echo $JUST_SITE_NAME`'/g' mgosites-admin/index.html

{'fraction_non_alphanumeric': 0.13788895668090298, 'fraction_numerical': 0.0012202562538133007, 'mean_word_length': 2.54978354978355, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7405081', 'n_tokens_mistral': 637, 'n_tokens_neox': 594, 'n_words': 159}