summaryrefslogtreecommitdiffstats
path: root/rulemgt-standalone/src/main/assembly/bin
diff options
context:
space:
mode:
Diffstat (limited to 'rulemgt-standalone/src/main/assembly/bin')
-rw-r--r--rulemgt-standalone/src/main/assembly/bin/initDB.sh8
-rw-r--r--rulemgt-standalone/src/main/assembly/bin/run.sh25
2 files changed, 28 insertions, 5 deletions
diff --git a/rulemgt-standalone/src/main/assembly/bin/initDB.sh b/rulemgt-standalone/src/main/assembly/bin/initDB.sh
index c9b5705..19a2297 100644
--- a/rulemgt-standalone/src/main/assembly/bin/initDB.sh
+++ b/rulemgt-standalone/src/main/assembly/bin/initDB.sh
@@ -19,18 +19,20 @@ DIRNAME=`dirname $0`
HOME=`cd $DIRNAME/; pwd`
user=$1
password=$2
-port=$3
-host=$4
+dbname=$3
+port=$4
+host=$5
echo "start init holmes rulemgt db"
main_path=$HOME/..
cat $main_path/dbscripts/postgresql/onap-holmes_rulemgt-createobj.sql
+echo "dbname=$dbname"
echo "user="$user
echo "password="$password
echo "port="$port
echo "host="$host
export PGPASSWORD=$password
psql -U $user -p $port -h $host -f $main_path/dbscripts/postgresql/onap-holmes_rulemgt-createobj.sql
-psql -U $user -p $port -h $host -d holmes --command 'select * from aplus_rule;'
+psql -U $user -p $port -h $host -d $dbname --command 'select * from aplus_rule;'
sql_result=$?
unset PGPASSWORD
cat "sql_result="$sql_result
diff --git a/rulemgt-standalone/src/main/assembly/bin/run.sh b/rulemgt-standalone/src/main/assembly/bin/run.sh
index 592f85d..6b3b42d 100644
--- a/rulemgt-standalone/src/main/assembly/bin/run.sh
+++ b/rulemgt-standalone/src/main/assembly/bin/run.sh
@@ -33,7 +33,24 @@ echo @JAVA_OPTS@ $JAVA_OPTS
class_path="$main_path/:$main_path/holmes-rulemgt.jar"
echo @class_path@ $class_path
-sed -i "s|url:.*|url: jdbc:postgresql://$URL_JDBC/holmes|" "$main_path/conf/rulemgt.yml"
+if [ -z ${JDBC_USERNAME} ]; then
+ export JDBC_USERNAME=holmes
+ echo "No user name is specified for the database. Use the default value \"$JDBC_USERNAME\"."
+fi
+
+if [ -z ${JDBC_PASSWORD} ]; then
+ export JDBC_PASSWORD=holmespwd
+ echo "No password is specified for the database. Use the default value \"$JDBC_PASSWORD\"."
+fi
+
+if [ -z ${DB_NAME} ]; then
+ export DB_NAME=holmes
+ echo "No database is name is specified. Use the default value \"$DB_NAME\"."
+fi
+
+sed -i "s|user:.*|user: $JDBC_USERNAME|" "$main_path/conf/rulemgt.yml"
+sed -i "s|password:.*|password: $JDBC_PASSWORD|" "$main_path/conf/rulemgt.yml"
+sed -i "s|url:.*|url: jdbc:postgresql://$URL_JDBC/$DB_NAME|" "$main_path/conf/rulemgt.yml"
sed -i "s|msbServerAddr:.*|msbServerAddr: http://$MSB_ADDR|" "$main_path/conf/rulemgt.yml"
export SERVICE_IP=`hostname -i`
@@ -47,8 +64,12 @@ if [ ! -z ${TESTING} ] && [ ${TESTING} == 1 ]; then
fi
fi
+export DB_PORT=5432
+if [ ! -z ${URL_JDBC} ] && [ `expr index $URL_JDBC :` != 0 ]; then
+ export DB_PORT="${URL_JDBC##*:}"
+if
-./bin/initDB.sh holmes holmespwd 5432 "${URL_JDBC%:*}"
+./bin/initDB.sh $JDBC_USERNAME $JDBC_PASSWORD $DB_NAME $DB_PORT "${URL_JDBC%:*}"
"$JAVA" $JAVA_OPTS -classpath "$class_path" org.onap.holmes.rulemgt.RuleActiveApp server "$main_path/conf/rulemgt.yml"