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

REDIS_URLS=${TWEMPROXY_URLS:-REDISCLOUD_URL}
n=1

for REDIS_URL in $REDIS_URLS
do
  echo "Setting ${REDIS_URL}_TWEMPROXY config var"
  eval REDIS_URL_VALUE=\$$REDIS_URL

  DB=$(echo ${REDIS_URL_VALUE} | perl -lne 'print "$1 $2 $3 $4 $5 $6" if /^redis(?:ql)?:\/\/([^:]+):([^@]+)@(.*?):(.*?)(\\?.*)?$/')
  DB_URI=( $DB )
  DB_USER=${DB_URI[0]}
  DB_PASS=${DB_URI[1]}
  DB_HOST=${DB_URI[2]}
  DB_PORT=${DB_URI[3]}

  NEW_URL=redis://${DB_USER}:${DB_PASS}@127.0.0.1:620${n}
  export ${REDIS_URL}_TWEMPROXY=${NEW_URL}<commit_msg>Rebuild config file at each invocation<commit_after>#!/usr/bin/env bash

REDIS_URLS=${TWEMPROXY_URLS:-REDISCLOUD_URL}
n=1

rm -f /app/vendor/twemproxy/twemproxy.yml

for REDIS_URL in $REDIS_URLS
do
  echo "Setting ${REDIS_URL}_TWEMPROXY config var"
  eval REDIS_URL_VALUE=\$$REDIS_URL

  DB=$(echo ${REDIS_URL_VALUE} | perl -lne 'print "$1 $2 $3 $4 $5 $6" if /^redis(?:ql)?:\/\/([^:]+):([^@]+)@(.*?):(.*?)(\\?.*)?$/')
  DB_URI=( $DB )
  DB_USER=${DB_URI[0]}
  DB_PASS=${DB_URI[1]}
  DB_HOST=${DB_URI[2]}
  DB_PORT=${DB_URI[3]}

  NEW_URL=redis://${DB_USER}:${DB_PASS}@127.0.0.1:620${n}
  export ${REDIS_URL}_TWEMPROXY=${NEW_URL}
{'fraction_non_alphanumeric': 0.25252525252525254, 'fraction_numerical': 0.03367003367003367, 'mean_word_length': 5.39247311827957, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1275888', 'n_tokens_mistral': 596, 'n_tokens_neox': 568, 'n_words': 83}