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

. "/srv/provision/provisioners.sh"

SITE=$1
SITE_ESCAPED="${SITE//./\\.}"
REPO=$2
BRANCH=$3
VM_DIR=$4
SKIP_PROVISIONING=$5
NGINX_UPSTREAM=$6
VVV_PATH_TO_SITE=${VM_DIR} # used in site templates
VVV_SITE_NAME=${SITE}



SUCCESS=1

# By storing the date now, we can calculate the duration of provisioning at the
# end of this script.

VVV_CONFIG=/vagrant/config.yml

# Takes 2 values, a key to fetch a value for, and an optional default value
# e.g. echo $(get_config_value 'key' 'defaultvalue')
function get_config_value() {
  local value=$(shyaml get-value "sites.${SITE_ESCAPED}.custom.${1}" 2> /dev/null < ${VVV_CONFIG})
  echo "${value:-$2}"
}

function get_hosts() {
  local value=$(shyaml get-values-0 "sites.${SITE_ESCAPED}.hosts" 2> /dev/null < ${VVV_CONFIG} | tr '\0' ' ' | sed 's/ *$//')
  echo "${value:-$@}"
}

function get_primary_host() {
  local value=$(shyaml get-value "sites.${SITE_ESCAPED}.hosts.0" 2> /dev/null < ${VVV_CONFIG})
  echo "${value:-$1}"
}

function vvv_provision_site_nginx_config() {
  SITE_NGINX_FILE=$2
  DEST_NGINX_FILE=${SITE_NGINX_FILE//\/srv\/www\//}
  DEST_NGINX_FILE=${DEST_NGINX_FILE//\//\-}
  DEST_NGINX_FILE=${DEST_NGINX_FILE/%-vvv-nginx.conf/}
  DEST_NGINX_FILE="vvv-auto-${DEST_NGINX_FILE}-$(md5sum <<< "${SITE_NGINX_FILE}" | cut -c1-32).conf"<commit_msg>shyaml has a "default" parameter on the command, use it<commit_after>#!/usr/bin/env bash

. "/srv/provision/provisioners.sh"

SITE=$1
SITE_ESCAPED="${SITE//./\\.}"
REPO=$2
BRANCH=$3
VM_DIR=$4
SKIP_PROVISIONING=$5
NGINX_UPSTREAM=$6
VVV_PATH_TO_SITE=${VM_DIR} # used in site templates
VVV_SITE_NAME=${SITE}



SUCCESS=1

# By storing the date now, we can calculate the duration of provisioning at the
# end of this script.

VVV_CONFIG=/vagrant/config.yml

# Takes 2 values, a key to fetch a value for, and an optional default value
# e.g. echo $(get_config_value 'key' 'defaultvalue')
function get_config_value() {
  local value=$(shyaml get-value "sites.${SITE_ESCAPED}.custom.${1}" "${2}" 2> /dev/null < ${VVV_CONFIG})
  echo "${value}"
}

function get_hosts() {
  local value=$(shyaml get-values-0 "sites.${SITE_ESCAPED}.hosts" 2> /dev/null < ${VVV_CONFIG} | tr '\0' ' ' | sed 's/ *$//')
  echo "${value:-$@}"
}

function get_primary_host() {
  local value=$(shyaml get-value "sites.${SITE_ESCAPED}.hosts.0" "${1}" 2> /dev/null < ${VVV_CONFIG})
  echo "${value}"
}

function vvv_provision_site_nginx_config() {
  SITE_NGINX_FILE=$2
  DEST_NGINX_FILE=${SITE_NGINX_FILE//\/srv\/www\//}
  DEST_NGINX_FILE=${DEST_NGINX_FILE//\//\-}
  DEST_NGINX_FILE=${DEST_NGINX_FILE/%-vvv-nginx.conf/}
  DEST_NGINX_FILE="vvv-auto-${DEST_NGINX_FILE}-$(md5sum <<< "${SITE_NGINX_FILE}" | cut -c1-32).conf"
{'fraction_non_alphanumeric': 0.1849264705882353, 'fraction_numerical': 0.016176470588235296, 'mean_word_length': 4.764830508474576, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4010364', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1135, 'n_words': 216}