<commit_before>#!/usr/bin/env bash

substitutions="\${APP_DOMAIN} \${APP_LOG_LEVEL} \${APP_PUBLIC_DIR}"

if [ ! -f /etc/php/7.1/fpm/php-fpm.conf ]; then
    envsubst "${substitutions}" < /etc/php/7.1/fpm/php-fpm.conf.template > /etc/php/7.1/fpm/php-fpm.conf
fi

if [ ! -f /etc/nginx/sites-available/api.myparcel.com ]; then
    envsubst "${substitutions}" < /etc/nginx/sites-available/default.template > /etc/nginx/sites-available/default
fi

if [ ! -f /etc/supervisor/conf.d/supervisord.conf ]; then
    envsubst "${substitutions}" < /etc/supervisor/conf.d/supervisord.conf.template > /etc/supervisor/conf.d/supervisord.conf
fi

if [ ! "${DOCKER_ENV}" == "production" ] && [ ! "${DOCKER_ENV}" == "prod" ]; then
    # Enable xdebug
    ln -sf /etc/php/7.1/mods-available/xdebug.ini /etc/php/7.1/fpm/conf.d/20-xdebug.ini
else
    # Disable xdebug
    if [ -e /etc/php/7.1/fpm/conf.d/20-xdebug.ini ]; then
        rm -f /etc/php/7.1/fpm/conf.d/20-xdebug.ini
    fi
fi

sed -i "s/xdebug\.remote_host\=.*/xdebug\.remote_host\=${APP_DOMAIN}/g" /etc/php/7.1/mods-available/xdebug.ini

$@<commit_msg>:recycle: Added some comments to the entrypoint script.<commit_after>#!/usr/bin/env bash

: '================================================
Setting up configuration files
==================================================='

substitutions="\${APP_DOMAIN} \${APP_LOG_LEVEL} \${APP_PUBLIC_DIR}"

if [ ! -f /etc/php/7.1/fpm/php-fpm.conf ]; then
    envsubst "${substitutions}" < /etc/php/7.1/fpm/php-fpm.conf.template > /etc/php/7.1/fpm/php-fpm.conf
fi

if [ ! -f /etc/nginx/sites-available/default ]; then
    envsubst "${substitutions}" < /etc/nginx/sites-available/default.template > /etc/nginx/sites-available/default
fi

if [ ! -f /etc/supervisor/conf.d/supervisord.conf ]; then
    envsubst "${substitutions}" < /etc/supervisor/conf.d/supervisord.conf.template > /etc/supervisor/conf.d/supervisord.conf
fi

: '================================================
Configuring Xdebug
==================================================='

if [ ! "${DOCKER_ENV}" == "production" ] && [ ! "${DOCKER_ENV}" == "prod" ]; then
    # Enable xdebug
    ln -sf /etc/php/7.1/mods-available/xdebug.ini /etc/php/7.1/fpm/conf.d/20-xdebug.ini
else
    # Disable xdebug
    if [ -e /etc/php/7.1/fpm/conf.d/20-xdebug.ini ]; then
        rm -f /etc/php/7.1/fpm/conf.d/20-xdebug.ini
    fi
fi

sed -i "s/xdebug\.remote_host\=.*/xdebug\.remote_host\=${APP_DOMAIN}/g" /etc/php/7.1/mods-available/xdebug.ini

: '================================================
Continue with passed in command
==================================================='

"$@"
{'fraction_non_alphanumeric': 0.2880579931323922, 'fraction_numerical': 0.016787485692483783, 'mean_word_length': 3.6654804270462633, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4073388', 'n_tokens_mistral': 1034, 'n_tokens_neox': 984, 'n_words': 138}