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

[[ $DEBUG == true ]] && set -x

check_database_connection() {
  case ${DB_DRIVER} in
    mysql)
      prog="mysqladmin -h ${DB_HOST} -u ${DB_USERNAME} ${DB_PASSWORD:+-p$DB_PASSWORD} status"
      ;;
    pgsql)
      prog=$(find /usr/lib/postgresql/ -name pg_isready)
      prog="${prog} -h ${DB_HOST} -U ${DB_USERNAME} -d ${DB_DATABASE} -t 1"
      ;;
  esac
  timeout=60
  while ! ${prog} >/dev/null 2>&1
  do
    timeout=$(expr $timeout - 1)
    if [[ $timeout -eq 0 ]]; then
      echo
      echo "Could not connect to database server. Aborting..."
      return 1
    fi
    echo -n "."
    sleep 1
  done
  echo
}

initialize_system() {
  APP_ENV=${APP_ENV:-development}
  APP_DEBUG=${APP_DEBUG:-true}
  APP_URL=${APP_URL:-http://localhost}
  APP_KEY=${APP_KEY:-SECRET}

  DB_DRIVER=${DB_DRIVER:-mysql}
  DB_HOST=${DB_HOST:-mysql}
  DB_DATABASE=${DB_DATABASE:-cachet}
  DB_USERNAME=${DB_USERNAME:-cachet}
  DB_PASSWORD=${DB_PASSWORD:-<PASSWORD>}

  CACHE_DRIVER=${CACHE_DRIVER:-apc}
  SESSION_DRIVER=${SESSION_DRIVER:-apc}
  QUEUE_DRIVER=${QUEUE_DRIVER:-apc}

  MAIL_DRIVER=${MAIL_DRIVER:-smtp}
  MAIL_HOST=${MAIL_HOST:-mailtrap.io}
  MAIL_PORT=${MAIL_PORT:-2525}
  MAIL_USERNAME=${MAIL_USERNAME:-null}
  MAIL_PASSWORD=${MAIL_PASSWORD:-null}
  MAIL_ADDRESS=${MAIL_ADDRESS:-null}
  MAIL_NAME=${MAIL_NAME:-null}

  REDIS_HOST=${REDIS_HOST:-null}
  REDIS_DATABASE=${REDIS_DATABASE:-null}
  REDIS_PORT=${REDIS_PORT:-null}

  # configure env file

  sed 's,{{APP_ENV}},'"${APP_ENV}"',g' -i /var/www/html/.env
  sed 's,{{APP_DEBUG}},'"${APP_DEBUG}"',g' -i /var/www/html/.env
  sed 's,{{APP_URL}},'"${APP_URL}"',g' -i /var/www/html/.env
  sed 's,{{APP_KEY}},'"${APP_KEY}"',g' -i /var/www/html/.env

  sed 's,{{DB_DRIVER}},'"${DB_DRIVER}"',g' -i /var/www/html/.env
  sed 's,{{DB_HOST}},'"${DB_HOST}"',g' -i /var/www/html/.env
  sed 's,{{DB_DATABASE}},'"${DB_DATABASE}"',g' -i /var/www/html/.env
  sed 's,{{DB_USERNAME}},'"${DB_USERNAME}"',g' -i /var/www/html/.env
  sed 's,{{DB_PASSWORD}},'"${DB_PASSWORD}"',g' -i /var/www/html/.env

  sed 's,{{CACHE_DRIVER}},'"${CACHE_DRIVER}"',g' -i /var/www/html/.env<commit_msg>Set database as default queue driver, closes #63<commit_after>#!/bin/bash
set -e

[[ $DEBUG == true ]] && set -x

check_database_connection() {
  case ${DB_DRIVER} in
    mysql)
      prog="mysqladmin -h ${DB_HOST} -u ${DB_USERNAME} ${DB_PASSWORD:+-p$DB_PASSWORD} status"
      ;;
    pgsql)
      prog=$(find /usr/lib/postgresql/ -name pg_isready)
      prog="${prog} -h ${DB_HOST} -U ${DB_USERNAME} -d ${DB_DATABASE} -t 1"
      ;;
  esac
  timeout=60
  while ! ${prog} >/dev/null 2>&1
  do
    timeout=$(expr $timeout - 1)
    if [[ $timeout -eq 0 ]]; then
      echo
      echo "Could not connect to database server. Aborting..."
      return 1
    fi
    echo -n "."
    sleep 1
  done
  echo
}

initialize_system() {
  APP_ENV=${APP_ENV:-development}
  APP_DEBUG=${APP_DEBUG:-true}
  APP_URL=${APP_URL:-http://localhost}
  APP_KEY=${APP_KEY:-SECRET}

  DB_DRIVER=${DB_DRIVER:-mysql}
  DB_HOST=${DB_HOST:-mysql}
  DB_DATABASE=${DB_DATABASE:-cachet}
  DB_USERNAME=${DB_USERNAME:-cachet}
  DB_PASSWORD=${DB_PASSWORD:-<PASSWORD>}

  CACHE_DRIVER=${CACHE_DRIVER:-apc}
  SESSION_DRIVER=${SESSION_DRIVER:-apc}
  QUEUE_DRIVER=${QUEUE_DRIVER:-database}

  MAIL_DRIVER=${MAIL_DRIVER:-smtp}
  MAIL_HOST=${MAIL_HOST:-mailtrap.io}
  MAIL_PORT=${MAIL_PORT:-2525}
  MAIL_USERNAME=${MAIL_USERNAME:-null}
  MAIL_PASSWORD=${MAIL_PASSWORD:-null}
  MAIL_ADDRESS=${MAIL_ADDRESS:-null}
  MAIL_NAME=${MAIL_NAME:-null}

  REDIS_HOST=${REDIS_HOST:-null}
  REDIS_DATABASE=${REDIS_DATABASE:-null}
  REDIS_PORT=${REDIS_PORT:-null}

  # configure env file

  sed 's,{{APP_ENV}},'"${APP_ENV}"',g' -i /var/www/html/.env
  sed 's,{{APP_DEBUG}},'"${APP_DEBUG}"',g' -i /var/www/html/.env
  sed 's,{{APP_URL}},'"${APP_URL}"',g' -i /var/www/html/.env
  sed 's,{{APP_KEY}},'"${APP_KEY}"',g' -i /var/www/html/.env

  sed 's,{{DB_DRIVER}},'"${DB_DRIVER}"',g' -i /var/www/html/.env
  sed 's,{{DB_HOST}},'"${DB_HOST}"',g' -i /var/www/html/.env
  sed 's,{{DB_DATABASE}},'"${DB_DATABASE}"',g' -i /var/www/html/.env
  sed 's,{{DB_USERNAME}},'"${DB_USERNAME}"',g' -i /var/www/html/.env
  sed 's,{{DB_PASSWORD}},'"${DB_PASSWORD}"',g' -i /var/www/html/.env

  sed 's,{{CACHE_DRIVER}},'"${CACHE_DRIVER}"',g' -i /var/www/html/.env
{'fraction_non_alphanumeric': 0.2182741116751269, 'fraction_numerical': 0.006460544531610522, 'mean_word_length': 4.0642523364485985, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 20, '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': '2056051', 'n_tokens_mistral': 1883, 'n_tokens_neox': 1814, 'n_words': 270}