<commit_before>#!/bin/bash
set -e

# TODO: Set default env vars somewhere in case they don't come with "docker run"

if [ ! -f /init-done ]; then
	echo "Initialising Quilt.."

	# TODO: Perhaps this one could be dynamically changed through Apache environment vars
	sed -i -e "s|HOST_NAME|${HOST_NAME-http://acropolis.org.uk}|" /etc/apache2/sites-available/quilt
	sed -i -e "s|HOST_NAME|http://${HOST_NAME-acropolis.org.uk}/|" /usr/etc/quilt.conf
	sed -i -e "s|ENGINE|${ENGINE-file}|g" /usr/etc/quilt.conf
	sed -i -e "s|DATA_DIR_TTL|${DATA_DIR_TTL-/share/quilt/sample}|" /usr/etc/quilt.conf
	# Triple store settings
	sed -i -e "s|TRIPLESTORE_SPARQL|$TRIPLESTORE_SPARQL|" /usr/etc/quilt.conf<commit_msg>Add conditional wait for postgres<commit_after>#!/bin/bash
set -e

# TODO: Set default env vars somewhere in case they don't come with "docker run"

# Wait for postgres, if we're using spindle
if [ "${ENGINE}" = "spindle" ]; then
        until nc -z $POSTGRES_PORT_5432_TCP_ADDR $POSTGRES_PORT_5432_TCP_PORT; do
            echo "$(date) - waiting for postgres..."
            sleep 2
        done
fi

if [ ! -f /init-done ]; then
	echo "Initialising Quilt.."

	# TODO: Perhaps this one could be dynamically changed through Apache environment vars
	sed -i -e "s|HOST_NAME|${HOST_NAME-http://acropolis.org.uk}|" /etc/apache2/sites-available/quilt
	sed -i -e "s|HOST_NAME|http://${HOST_NAME-acropolis.org.uk}/|" /usr/etc/quilt.conf
	sed -i -e "s|ENGINE|${ENGINE-file}|g" /usr/etc/quilt.conf
	sed -i -e "s|DATA_DIR_TTL|${DATA_DIR_TTL-/share/quilt/sample}|" /usr/etc/quilt.conf
	# Triple store settings
	sed -i -e "s|TRIPLESTORE_SPARQL|$TRIPLESTORE_SPARQL|" /usr/etc/quilt.conf
{'fraction_non_alphanumeric': 0.15242080095636582, 'fraction_numerical': 0.00657501494321578, 'mean_word_length': 3.7556818181818183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1144490', 'n_tokens_mistral': 679, 'n_tokens_neox': 638, 'n_words': 157}