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

if [ "${1:0:1}" = '-' ]; then
	set -- supervisord "$@"
fi

if [ "$1" = 'supervisord' ]; then
	
	if [ ! -f /etc/rabbitmq/rabbitmq.config ] ; then

		if [ -z "$RABBITMQ_ADMIN_PASSWORD" ]; then
			echo >&2 'error: ariane is not configured and RABBITMQ_ADMIN_PASSWORD not set'
			echo >&2 '  Did you forget to add -e RABBITMQ_ADMIN_PASSWORD=... ?'
			exit 1
		fi
	
        echo "Performing initial config"
        cat > /etc/rabbitmq/rabbitmq.config <<-EOF
			[
			 {rabbit,
			  [
			   %% {reverse_dns_lookups, true},
			   {loopback_users, []},
			   {default_vhost,	   <<"/">>},
			   {default_user,		<<"admin">>},
			   {default_pass,		<<"<PASSWORD>">>},
			   {default_permissions, [<<".*">>, <<".*">>, <<".*">>]},
			   {default_user_tags, [administrator]}
			  ]
			 },
			 {kernel,
			  [
			   {inet_dist_listen_max, 44001},
			   {inet_dist_listen_min, 44001}
			  ]
			 }
			].
		EOF

        rabbitmq-server -detached
        echo "Waiting 10s for rabbitmq server to be ready"
        sleep 10

        if [ "$RABBITMQ_VHOST" -o "$RABBITMQ_USER" ]; then

            if [ "$RABBITMQ_VHOST" ]; then
                rabbitmqctl add_vhost $RABBITMQ_VHOST
            fi

            if [ "$RABBITMQ_USER" -a "$RABBITMQ_PASSWORD" ]; then
                rabbitmqctl add_user $RABBITMQ_USER $RABBITMQ_PASSWORD

                if [ "$RABBITMQ_VHOST" ]; then<commit_msg>Add permissions on vhost to admin user<commit_after>#!/bin/bash
set -e

if [ "${1:0:1}" = '-' ]; then
	set -- supervisord "$@"
fi

if [ "$1" = 'supervisord' ]; then
	
	if [ ! -f /etc/rabbitmq/rabbitmq.config ] ; then

		if [ -z "$RABBITMQ_ADMIN_PASSWORD" ]; then
			echo >&2 'error: ariane is not configured and RABBITMQ_ADMIN_PASSWORD not set'
			echo >&2 '  Did you forget to add -e RABBITMQ_ADMIN_PASSWORD=... ?'
			exit 1
		fi
	
        echo "Performing initial config"
        cat > /etc/rabbitmq/rabbitmq.config <<-EOF
			[
			 {rabbit,
			  [
			   %% {reverse_dns_lookups, true},
			   {loopback_users, []},
			   {default_vhost,	   <<"/">>},
			   {default_user,		<<"admin">>},
			   {default_pass,		<<"<PASSWORD>">>},
			   {default_permissions, [<<".*">>, <<".*">>, <<".*">>]},
			   {default_user_tags, [administrator]}
			  ]
			 },
			 {kernel,
			  [
			   {inet_dist_listen_max, 44001},
			   {inet_dist_listen_min, 44001}
			  ]
			 }
			].
		EOF

        rabbitmq-server -detached
        echo "Waiting 10s for rabbitmq server to be ready"
        sleep 10

        if [ "$RABBITMQ_VHOST" -o "$RABBITMQ_USER" ]; then

            if [ "$RABBITMQ_VHOST" ]; then
                rabbitmqctl add_vhost $RABBITMQ_VHOST
            fi

            if [ "$RABBITMQ_USER" -a "$RABBITMQ_PASSWORD" ]; then
                rabbitmqctl add_user $RABBITMQ_USER $RABBITMQ_PASSWORD

                if [ "$RABBITMQ_VHOST" ]; then
                    rabbitmqctl set_permissions -p $RABBITMQ_VHOST admin ".*" ".*" ".*"
{'fraction_non_alphanumeric': 0.15500170706725844, 'fraction_numerical': 0.014339364970979856, 'mean_word_length': 2.202185792349727, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 35, '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': '7652434', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1062, 'n_words': 222}