Ensure that all properties are passed on start-up
[aai/babel.git] / src / main / bin / start.sh
1 #!/bin/bash
2
3 # ============LICENSE_START=======================================================
4 # org.onap.aai
5 # ================================================================================
6 # Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
7 # Copyright © 2017-2018 European Software Marketing Ltd.
8 # ================================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
12 #
13 #      http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 # ============LICENSE_END=========================================================
21
22 AJSC_HOME="${AJSC_HOME-/opt/app/babel/}"
23 AJSC_CONF_HOME="$AJSC_HOME/bundleconfig"
24
25 if [ -z "$CONFIG_HOME" ]; then
26     echo "CONFIG_HOME must be set in order to start up the process"
27     exit 1
28 fi
29
30 # List of ajsc properties which are exposed for modification at deploy time
31 declare -a MODIFY_PROP_LIST=("KEY_STORE_PASSWORD"
32                              "KEY_MANAGER_PASSWORD"
33                              "AJSC_JETTY_ThreadCount_MIN" 
34                              "AJSC_JETTY_ThreadCount_MAX"
35                              "AJSC_JETTY_BLOCKING_QUEUE_SIZE")
36 PROP_LIST_LENGTH=${#MODIFY_PROP_LIST[@]}  
37
38 for (( i=1; i<${PROP_LIST_LENGTH}+1; i++ ));
39 do
40    PROP_NAME=${MODIFY_PROP_LIST[$i-1]}
41    PROP_VALUE=${!PROP_NAME}
42    if [ ! -z "$PROP_VALUE" ]; then
43       sed -i "s/$PROP_NAME=.*$/$PROP_NAME=$PROP_VALUE/g" $AJSC_CONF_HOME/etc/sysprops/sys-props.properties
44    fi
45 done
46
47 # Change the CLASSPATH separator to ; if your O/S is Windows
48 CLASSPATH="$AJSC_HOME/lib/*"
49 CLASSPATH="$CLASSPATH:$AJSC_HOME/extJars/"
50 CLASSPATH="$CLASSPATH:$AJSC_HOME/etc/"
51
52 PROPS="-DAJSC_HOME=$AJSC_HOME"
53 PROPS="$PROPS -DAJSC_CONF_HOME=$AJSC_CONF_HOME"
54 PROPS="$PROPS -DCONFIG_HOME=$CONFIG_HOME"
55 PROPS="$PROPS -Dlogback.configurationFile=$AJSC_CONF_HOME/bundleconfig/etc/logback.xml"
56 PROPS="$PROPS -DAJSC_SHARED_CONFIG=$AJSC_CONF_HOME"
57 PROPS="$PROPS -DAJSC_SERVICE_NAMESPACE=babel"
58 PROPS="$PROPS -DAJSC_SERVICE_VERSION=v1"
59 PROPS="$PROPS -Dserver.port=9516"
60 PROPS="$PROPS -Dartifactgenerator.config=$CONFIG_HOME/artifact-generator.properties"
61 JVM_MAX_HEAP=${MAX_HEAP:-1024}
62
63 echo $CLASSPATH
64
65 exec java -Xmx${JVM_MAX_HEAP}m $PROPS -classpath $CLASSPATH com.att.ajsc.runner.Runner context=// sslport=9516