<commit_before>#!/bin/bash -e

echo "[uaa-ctl] UAA Control Setting Up Logging"

exec > >(tee -a >(logger -p user.info -t vcap.$(basename $0).stdout) | awk -W interactive '{ system("echo -n [$(date +\"%Y-%m-%d %H:%M:%S%z\")]"); print " " $0 }' >>/var/vcap/sys/log/$(basename $0).log)
exec 2> >(tee -a >(logger -p user.error -t vcap.$(basename $0).stderr) | awk -W interactive '{ system("echo -n [$(date +\"%Y-%m-%d %H:%M:%S%z\")]"); print " " $0 }' >>/var/vcap/sys/log/$(basename $0).err.log)

echo "[uaa-ctl] UAA Control script invoked"
export PATH=/var/vcap/packages/uaa/jdk/bin:$PATH
RUN_DIR=/var/vcap/sys/run/uaa
LOG_DIR=/var/vcap/sys/log/uaa
JOB_DIR=/var/vcap/jobs/uaa
DATA_DIR=/var/vcap/data/uaa
PIDFILE=$RUN_DIR/uaa.pid
STATUS=/var/vcap/jobs/uaa/bin/status

# Proxy configuration variable for the uaa
HTTP_PROXY_JAVA_OPTIONS=""

echo "[uaa-ctl] Default environment set up"

if [[ -f /var/vcap/jobs/uaa/config/cacerts ]]; then
  export KEYSTORE="/var/vcap/jobs/uaa/config/cacerts"
else
  export KEYSTORE="/var/vcap/packages/uaa/jdk/jre/lib/security/cacerts"
fi

export KEYSTORE_OPTS="-Djavax.net.ssl.trustStore=$KEYSTORE -Djavax.net.ssl.trustStoreType=JKS"
echo "[uaa-ctl] Keystore configured to: $KEYSTORE"

# Proxy configuration
<% if_p('env.http_proxy') do |httpProxy| %>
export HTTP_PROXY='<%= httpProxy %>'
export http_proxy='<%= httpProxy %>'
proxy_conf=(`echo $HTTP_PROXY | tr ":" " " | tr "\/" " "`)
HTTP_PROXY_JAVA_OPTIONS="$HTTP_PROXY_JAVA_OPTIONS -Dhttp.proxyHost=${proxy_conf[1]} -Dhttp.proxyPort=${proxy_conf[2]} "
<% end %>

<% if_p('env.https_proxy') do |httpsProxy| %>
export HTTPS_PROXY='<%= httpsProxy %>'
export https_proxy='<%= httpsProxy %>'
proxy_conf=(`echo $HTTPS_PROXY | tr ":" " " | tr "\/" " "`)
HTTP_PROXY_JAVA_OPTIONS="$HTTP_PROXY_JAVA_OPTIONS -Dhttps.proxyHost=${proxy_conf[1]} -Dhttps.proxyPort=${proxy_conf[2]} "<commit_msg>Bring upstream changes to uaa_ctl<commit_after>#!/bin/bash -e

echo "[uaa-ctl] UAA Control Setting Up Logging"

exec > >(tee -a >(logger -p user.info -t vcap.$(basename $0).stdout) | awk -W interactive '{ system("echo -n [$(date +\"%Y-%m-%d %H:%M:%S%z\")]"); print " " $0 }' >>/var/vcap/sys/log/$(basename $0).log)
exec 2> >(tee -a >(logger -p user.error -t vcap.$(basename $0).stderr) | awk -W interactive '{ system("echo -n [$(date +\"%Y-%m-%d %H:%M:%S%z\")]"); print " " $0 }' >>/var/vcap/sys/log/$(basename $0).err.log)

echo "[uaa-ctl] UAA Control script invoked"
export PATH=/var/vcap/packages/uaa/jdk/bin:$PATH
RUN_DIR=/var/vcap/sys/run/uaa
LOG_DIR=/var/vcap/sys/log/uaa
JOB_DIR=/var/vcap/jobs/uaa
DATA_DIR=/var/vcap/data/uaa
STATUS=$DATA_DIR/uaa_status
PIDFILE=$RUN_DIR/uaa.pid

# Proxy configuration variable for the uaa
HTTP_PROXY_JAVA_OPTIONS=""

echo "[uaa-ctl] Default environment set up"

if [[ -f /var/vcap/jobs/uaa/config/cacerts ]]; then
  export KEYSTORE="/var/vcap/jobs/uaa/config/cacerts"
else
  export KEYSTORE="/var/vcap/packages/uaa/jdk/jre/lib/security/cacerts"
fi

export KEYSTORE_OPTS="-Djavax.net.ssl.trustStore=$KEYSTORE -Djavax.net.ssl.trustStoreType=JKS"
echo "[uaa-ctl] Keystore configured to: $KEYSTORE"

# Proxy configuration
<% if_p('env.http_proxy') do |httpProxy| %>
export HTTP_PROXY='<%= httpProxy %>'
export http_proxy='<%= httpProxy %>'
proxy_conf=(`echo $HTTP_PROXY | tr ":" " " | tr "\/" " "`)
HTTP_PROXY_JAVA_OPTIONS="$HTTP_PROXY_JAVA_OPTIONS -Dhttp.proxyHost=${proxy_conf[1]} -Dhttp.proxyPort=${proxy_conf[2]} "
<% end %>

<% if_p('env.https_proxy') do |httpsProxy| %>
export HTTPS_PROXY='<%= httpsProxy %>'
export https_proxy='<%= httpsProxy %>'
proxy_conf=(`echo $HTTPS_PROXY | tr ":" " " | tr "\/" " "`)
HTTP_PROXY_JAVA_OPTIONS="$HTTP_PROXY_JAVA_OPTIONS -Dhttps.proxyHost=${proxy_conf[1]} -Dhttps.proxyPort=${proxy_conf[2]} "
{'fraction_non_alphanumeric': 0.20841146530940263, 'fraction_numerical': 0.005893383337798017, 'mean_word_length': 5.061688311688312, 'pattern_counts': {'":': 4, '<': 17, '<?xml version=': 0, '>': 37, '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': '7532869', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1547, 'n_words': 270}