<commit_before>#!/bin/bash
# ------------------------------------------------------------------------
#
# Copyright 2005-2015 WSO2, Inc. (http://wso2.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
#
# ------------------------------------------------------------------------
set -e

local_ip=`ip route get 1 | awk '{print $NF;exit}'`
server_path=/mnt/${local_ip}
echo "Creating directory $server_path..."
mkdir -p $server_path

server_name=${WSO2_SERVER}-${WSO2_SERVER_VERSION}
echo "Moving carbon server from /mnt/${server_name} to ${server_path}..."
mv /mnt/${server_name} ${server_path}/
export CARBON_HOME="${server_path}/${server_name}"

echo "JAVA_HOME=${JAVA_HOME}" >> /etc/environment
echo "CARBON_HOME=${CARBON_HOME}" >> /etc/environment

echo "Starting ${WSO2_SERVER}..."
${CARBON_HOME}/bin/wso2server.sh<commit_msg>changing docker init script to resolve localMemberHost to local ip address<commit_after>#!/bin/bash
# ------------------------------------------------------------------------
#
# Copyright 2005-2015 WSO2, Inc. (http://wso2.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
#
# ------------------------------------------------------------------------
set -e

local_ip=`ip route get 1 | awk '{print $NF;exit}'`
server_path=/mnt/${local_ip}
echo "Creating directory $server_path..."
mkdir -p $server_path

server_name=${WSO2_SERVER}-${WSO2_SERVER_VERSION}
echo "Moving carbon server from /mnt/${server_name} to ${server_path}..."
mv /mnt/${server_name} ${server_path}/

# add host mapping
# $1 = hostname
# $2 = ip address
function add_host_mapping {
    if [[ ! -z $1 && $1 != $2 ]];
    then
        echo "$local_ip   $local_member_host" >> /etc/hosts
      else
        echo "localMemberHost is not set | already set to local ip"
    fi
}

# resolve localMemberHost
axis2_file_path=${server_path}/repository/conf/axis2/axis2.xml
local_member_host=`grep -oP "<parameter\ name=\"localMemberHost\">(.*)</parameter>" $axis2_file_path | cut -d ">" -f 2 | cut -d "<" -f 1`
echo "found localMemberhost = $local_member_host"
add_host_mapping "$local_member_host" "$local_ip"

# resolve hostname
#carbon_file_path=${server_path}/repository/conf/carbon.xml
#carbon_hostname=`grep -oP "<HostName>(.*)</HostName>" $carbon_file_path | cut -d ">" -f 2 | cut -d "<" -f 1`
#echo "found carbon host name = $carbon_hostname"
#add_host_mapping $carbon_hostname $local_ip

export CARBON_HOME="${server_path}/${server_name}"

echo "JAVA_HOME=${JAVA_HOME}" >> /etc/environment
echo "CARBON_HOME=${CARBON_HOME}" >> /etc/environment

echo "Starting ${WSO2_SERVER}..."
${CARBON_HOME}/bin/wso2server.sh
{'fraction_non_alphanumeric': 0.20383759733036708, 'fraction_numerical': 0.01418242491657397, 'mean_word_length': 3.168018539976825, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '3851556', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1071, 'n_words': 338}