<commit_before>#!/bin/bash
if [ "$(ls -A $INSPECTIT_CONFIG_HOME)" ]; then
	echo "Using existing inspectIT configuration..."
else
	if ([ -z $INSPECTIT_CMR_ADDR ] || [ -z $INSPECTIT_CMR_PORT ]) && ([ -z $CMR_PORT_9070_TCP_ADDR ] || [ -z $CMR_PORT_9070_TCP_PORT ]); then
                echo "No inspectIT CMR configured! Please read our README"
                exit 1
        fi

	echo "No custom inspectIT configuration found, using default one..."
	cp -r $INSPECTIT_CONFIG_HOME/../config/* $INSPECTIT_CONFIG_HOME
	CMR_ADDR=${INSPECTIT_CMR_ADDR:-cmr}
	CMR_PORT=${INSPECTIT_CMR_PORT:-9070}

	AGENT_NAME=${AGENT_NAME:-$HOSTNAME}
	sed -i "s/^\(repository\) .*/\1 $CMR_ADDR $CMR_PORT $AGENT_NAME/" $INSPECTIT_CONFIG_HOME/inspectit-agent.cfg
	echo "Done. Remember to modify the configuration for your needs. You find the configuration in the mapped volume $INSPECTIT_CONFIG_HOME." 
fi

exec catalina.sh "$@"<commit_msg>Add version checks before starting the server<commit_after>#!/bin/bash
if [ "$(ls -A $INSPECTIT_CONFIG_HOME)" ]; then
	echo "[INFO] Using existing inspectIT configuration..."
else
	if ([ -z $INSPECTIT_CMR_ADDR ] || [ -z $INSPECTIT_CMR_PORT ]) && ([ -z $CMR_PORT_9070_TCP_ADDR ] || [ -z $CMR_PORT_9070_TCP_PORT ]); then
                echo "[ERROR] No inspectIT CMR configured! Please read our README"
                exit 1
        fi

	echo "[INFO] No custom inspectIT configuration found, using default one..."
	cp -r $INSPECTIT_CONFIG_HOME/../config/* $INSPECTIT_CONFIG_HOME
	CMR_ADDR=${INSPECTIT_CMR_ADDR:-cmr}
	CMR_PORT=${INSPECTIT_CMR_PORT:-9070}

	AGENT_NAME=${AGENT_NAME:-$HOSTNAME}
	sed -i "s/^\(repository\) .*/\1 $CMR_ADDR $CMR_PORT $AGENT_NAME/" $INSPECTIT_CONFIG_HOME/inspectit-agent.cfg
	echo "[INFO] Done. Remember to modify the configuration for your needs. You find the configuration in the mapped volume $INSPECTIT_CONFIG_HOME." 
fi

# Version check
if ([[ -n $INSPECTIT_VERSION && -n $CMR_ENV_INSPECTIT_VERSION && $INSPECTIT_VERSION != $CMR_ENV_INSPECTIT_VERSION ]]); then
	echo "[ERROR] Version of inspectIT CMR and agent do not match:"
	echo "[ERROR] Agent: $INSPECTIT_VERSION"
	echo "[ERROR] CMR: $CMR_ENV_INSPECTIT_VERSION"
	echo "[ERROR] You have to use the same version for CMR and agent."
	exit 1
else
	CMR_REST_VERSION=$(wget http://$CMR_ADDR:$CMR_PORT/rest/cmr/version -qO-)
	if ([[ $? -eq 0 && $INSPECTIT_VERSION != $CMR_REST_VERSION ]]); then
		echo "[ERROR] Version of inspectIT CMR and agent do not match:"
		echo "[ERROR] Agent: $INSPECTIT_VERSION"
		echo "[ERROR] CMR: $CMR_REST_VERSION"
		echo "[ERROR] You have to use the same version for CMR and agent."
		exit 1
	fi
	echo "[INFO] Running inspectIT with version $INSPECTIT_VERSION"
	echo "[INFO] Make sure your CMR has the same version"
fi

exec catalina.sh "$@"
{'fraction_non_alphanumeric': 0.1259500542888165, 'fraction_numerical': 0.011219688744118711, 'mean_word_length': 4.234848484848484, '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': '7352644', 'n_tokens_mistral': 1010, 'n_tokens_neox': 960, 'n_words': 277}