diff options
author | DR695H <dr695h@att.com> | 2017-02-07 13:11:03 -0500 |
---|---|---|
committer | DR695H <dr695h@att.com> | 2017-02-07 13:12:28 -0500 |
commit | 13ce0552dc7156b6e3e226c00295705f27780a40 (patch) | |
tree | a9ada50d0a86c0fdc253c188d1328f6e880bfaf5 /vid/src/main/swm/common | |
parent | 77b87f76ff2799bd1f5fe85552f1c5e7081eb4df (diff) |
actually adding the files to the initial commit
Change-Id: I2f0c09692c2ae70be61b8bb552fd1bd2983eb661
Signed-off-by: DR695H <dr695h@att.com>
Diffstat (limited to 'vid/src/main/swm/common')
-rw-r--r-- | vid/src/main/swm/common/common.sh | 35 | ||||
-rw-r--r-- | vid/src/main/swm/common/localize.sh | 33 | ||||
-rw-r--r-- | vid/src/main/swm/common/localize_asdc.sh | 68 | ||||
-rw-r--r-- | vid/src/main/swm/common/localize_cache.sh | 41 | ||||
-rw-r--r-- | vid/src/main/swm/common/localize_log4j.sh | 54 | ||||
-rw-r--r-- | vid/src/main/swm/common/localize_logback.sh | 46 | ||||
-rw-r--r-- | vid/src/main/swm/common/localize_portal.sh | 84 | ||||
-rw-r--r-- | vid/src/main/swm/common/localize_quartz.sh | 67 | ||||
-rw-r--r-- | vid/src/main/swm/common/localize_system.sh | 178 |
9 files changed, 606 insertions, 0 deletions
diff --git a/vid/src/main/swm/common/common.sh b/vid/src/main/swm/common/common.sh new file mode 100644 index 00000000..7308ffc7 --- /dev/null +++ b/vid/src/main/swm/common/common.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +if [[ "${INSTALL_ROOT}" = */ ]]; then + export ROOT_DIR=${INSTALL_ROOT}opt/app/vid/portal +else + export ROOT_DIR=${INSTALL_ROOT}/opt/app/vid/portal +fi + +export JAVA_HOME=/opt/app/java/jdk/jdk180 + + +OS=`uname` + +if [ "${OS}" = "SunOS" ]; then + CURRENT_USER=`/usr/xpg4/bin/id -un` + CURRENT_GROUP=`/usr/xpg4/bin/id -gn` +else + CURRENT_USER=`id -un` + CURRENT_GROUP=`id -gn` +fi + +export CURRENT_USER CURRENT_GROUP +export TOMCAT_HOME=/opt/app/vid/tomcat + +if [ -z "${VID_ENDPOINT_NAME}" ]; then + VID_ENDPOINT_NAME="vid" +fi + +# Fail - used to quickly exit with a rc and error message +fail() { + rc=$1 + shift; + echo "ERROR: $@" + exit $rc +} diff --git a/vid/src/main/swm/common/localize.sh b/vid/src/main/swm/common/localize.sh new file mode 100644 index 00000000..9db6c4ec --- /dev/null +++ b/vid/src/main/swm/common/localize.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +COMMON_DIR="$(dirname "$AFTSWM_ACTIONHANDLER_SCRIPT")/../../common" + +source "${COMMON_DIR}/localize_logback.sh" || { + echo "ERROR: Localizing logback.xml failed" + exit 1 +} + +source "${COMMON_DIR}/localize_portal.sh" || { + echo "ERROR: Localizing portal.properties failed" + exit 1 +} + +source "${COMMON_DIR}/localize_quartz.sh" || { + echo "ERROR: Localizing quartz.properties failed" + exit 1 +} + +source "${COMMON_DIR}/localize_system.sh" || { + echo "ERROR: Localizing system.properties failed" + exit 1 +} + +source "${COMMON_DIR}/localize_cache.sh" || { + echo "ERROR: Localizing cache.ccf failed" + exit 1 +} + +source "${COMMON_DIR}/localize_asdc.sh" || { + echo "ERROR: Localizing asdc.properties failed" + exit 1 +} diff --git a/vid/src/main/swm/common/localize_asdc.sh b/vid/src/main/swm/common/localize_asdc.sh new file mode 100644 index 00000000..8af7662e --- /dev/null +++ b/vid/src/main/swm/common/localize_asdc.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/asdc.properties +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/asdc_template.properties +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/asdc.properties.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/asdc.properties.bk.2 + +echo "Localizing the ASDC client configuration" + +if [ -z "${ASDC_CLIENT_TYPE}" ]; then + ASDC_CLIENT_TYPE=REST +fi + +if [ "${ASDC_CLIENT_TYPE}" = "REST" ]; then + if [ -z "${ASDC_CLIENT_REST_HOST}" ]; then + echo 'ASDC_CLIENT_REST_HOST must be provided when ASDC_CLIENT_TYPE=REST' + exit 1 + fi + + if [ -z "${ASDC_CLIENT_REST_AUTH}" ]; then + echo 'ASDC_CLIENT_REST_AUTH must be provided when ASDC_CLIENT_TYPE=REST' + exit 2 + fi + + if [ -z "${ASDC_CLIENT_REST_PROTOCOL}" ]; then + ASDC_CLIENT_REST_PROTOCOL=http + fi + + if [ -z "${ASDC_CLIENT_REST_PORT}" ]; then + ASDC_CLIENT_REST_PORT=8080 + fi +else + ASDC_CLIENT_REST_HOST="" + ASDC_CLIENT_REST_AUTH="" + ASDC_CLIENT_REST_PROTOCOL="http" + ASDC_CLIENT_REST_PORT="8080" +fi + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${BACKUP1_CONFIG_FILE} ]; then + cp -f ${BACKUP1_CONFIG_FILE} ${BACKUP2_CONFIG_FILE} || { + echo "ERROR: Could not copy ${BACKUP1_CONFIG_FILE} to ${BACKUP2_CONFIG_FILE}" + exit 2 + } +fi + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${FINAL_CONFIG_FILE} ]; then + cp -f ${FINAL_CONFIG_FILE} ${BACKUP1_CONFIG_FILE} || { + echo "ERROR: Could not copy ${FINAL_CONFIG_FILE} to ${BACKUP1_CONFIG_FILE}" + exit 3 + } +fi + +sed -e 's ${ASDC_CLIENT_TYPE} '${ASDC_CLIENT_TYPE}' g' \ + -e 's ${ASDC_CLIENT_REST_HOST} '${ASDC_CLIENT_REST_HOST}' g' \ + -e 's ${ASDC_CLIENT_REST_PORT} '${ASDC_CLIENT_REST_PORT}' g' \ + -e 's ${ASDC_CLIENT_REST_PROTOCOL} '${ASDC_CLIENT_REST_PROTOCOL}' g' \ + -e 's/${ASDC_CLIENT_REST_AUTH}/'"${ASDC_CLIENT_REST_AUTH}"'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 4 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/vid/src/main/swm/common/localize_cache.sh b/vid/src/main/swm/common/localize_cache.sh new file mode 100644 index 00000000..218d8a83 --- /dev/null +++ b/vid/src/main/swm/common/localize_cache.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache.ccf +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache_template.ccf +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache.ccf.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/cache.ccf.bk.2 + +echo "Localizing the VID cache configuration" + +if [ -z "${CACHE_DIRECTORY}" ]; then + CACHE_DIRECTORY=${ROOT_DIR}/cache +fi + +mkdir -p "${CACHE_DIRECTORY}" + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${BACKUP1_CONFIG_FILE} ]; then + cp -f ${BACKUP1_CONFIG_FILE} ${BACKUP2_CONFIG_FILE} || { + echo "ERROR: Could not copy ${BACKUP1_CONFIG_FILE} to ${BACKUP2_CONFIG_FILE}" + exit 1 + } +fi + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${FINAL_CONFIG_FILE} ]; then + cp -f ${FINAL_CONFIG_FILE} ${BACKUP1_CONFIG_FILE} || { + echo "ERROR: Could not copy ${FINAL_CONFIG_FILE} to ${BACKUP1_CONFIG_FILE}" + exit 2 + } +fi + +sed -e 's,${CACHE_DIRECTORY},'${CACHE_DIRECTORY}',g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 3 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/vid/src/main/swm/common/localize_log4j.sh b/vid/src/main/swm/common/localize_log4j.sh new file mode 100644 index 00000000..af117590 --- /dev/null +++ b/vid/src/main/swm/common/localize_log4j.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/log4j.properties +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/log4j_template.properties +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/log4j.properties.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/log4j.properties.bk.2 + +echo "Localizing the VID log4j configuration" + +if [ -z "${LOG4J_LOGLEVEL}" ]; then + LOG4J_LOGLEVEL=INFO +fi + + +if [ -z "${LOG4J_APPENDER}" ]; then + LOG4J_APPENDER=rollingfile +fi + +if [ -z "${LOG4J_LOGS_DIRECTORY}" ]; then + LOG4J_LOGS_DIRECTORY=${ROOT_DIR}/logs +fi + +mkdir -p ${LOG4J_LOGS_DIRECTORY} + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${BACKUP1_CONFIG_FILE} ]; then + cp -f ${BACKUP1_CONFIG_FILE} ${BACKUP2_CONFIG_FILE} || { + echo "ERROR: Could not copy ${BACKUP1_CONFIG_FILE} to ${BACKUP2_CONFIG_FILE}" + exit 1 + } +fi + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${FINAL_CONFIG_FILE} ]; then + cp -f ${FINAL_CONFIG_FILE} ${BACKUP1_CONFIG_FILE} || { + echo "ERROR: Could not copy ${FINAL_CONFIG_FILE} to ${BACKUP1_CONFIG_FILE}" + exit 2 + } +fi + +sed -e 's/${LOG4J_LOGLEVEL}/'${LOG4J_LOGLEVEL}'/g' \ + -e 's/${LOG4J_APPENDER}/'${LOG4J_APPENDER}'/g' \ + -e 's,${LOG4J_LOGS_DIRECTORY},'${LOG4J_LOGS_DIRECTORY}',g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 3 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." + + diff --git a/vid/src/main/swm/common/localize_logback.sh b/vid/src/main/swm/common/localize_logback.sh new file mode 100644 index 00000000..b38d7d52 --- /dev/null +++ b/vid/src/main/swm/common/localize_logback.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/logback.xml +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/logback_template.xml +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/logback.xml.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/logback.xml.bk.2 + +echo "Localizing the VID logback configuration" + +if [ -z "${VID_LOG_DIR}" ]; then + VID_LOG_DIR="${ROOT_DIR}/logs" +fi + +if [ -z "${VID_LOG_LEVEL}" ]; then + VID_LOG_LEVEL="INFO" +fi + +mkdir -p "${VID_LOG_DIR}" + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${BACKUP1_CONFIG_FILE} ]; then + cp -f ${BACKUP1_CONFIG_FILE} ${BACKUP2_CONFIG_FILE} || { + echo "ERROR: Could not copy ${BACKUP1_CONFIG_FILE} to ${BACKUP2_CONFIG_FILE}" + exit 1 + } +fi + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${FINAL_CONFIG_FILE} ]; then + cp -f ${FINAL_CONFIG_FILE} ${BACKUP1_CONFIG_FILE} || { + echo "ERROR: Could not copy ${FINAL_CONFIG_FILE} to ${BACKUP1_CONFIG_FILE}" + exit 2 + } +fi + +sed -e 's/${VID_LOG_LEVEL}/'${VID_LOG_LEVEL}'/g' \ + -e 's,${VID_LOG_DIR},'${VID_LOG_DIR}',g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 3 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/vid/src/main/swm/common/localize_portal.sh b/vid/src/main/swm/common/localize_portal.sh new file mode 100644 index 00000000..c1341fe5 --- /dev/null +++ b/vid/src/main/swm/common/localize_portal.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/portal.properties +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/portal_template.properties +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/portal.properties.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/classes/portal.properties.bk.2 + +echo "Localizing the VID portal configuration" + +if [ -z "${VID_ECOMP_REDIRECT_URL}" ]; then + VID_ECOMP_REDIRECT_URL=https://portal.openecomp.org/ecompportal/ecompportal/process_csp +fi + +if [ -z "${VID_WJ_LOGOUT_URL}" ]; then + VID_WJ_LOGOUT_URL=https://portal.openecomp.org/ecompportal/ecompportal/process_csp +fi + +if [ -z "${VID_ECOMP_REST_URL}" ]; then + VID_ECOMP_REST_URL=https://portal.openecomp.org/ecompportal/auxapi +fi + +if [ -z "${VID_UEB_URL_LIST}" ]; then + VID_UEB_URL_LIST=ueb.openecomp.org +fi + +if [ -z "${VID_UEB_CONSUMER_GROUP}" ]; then + VID_UEB_CONSUMER_GROUP=VID +fi + +if [ -z "${VID_ECOMP_PORTAL_INBOX_NAME}" ]; then + VID_ECOMP_PORTAL_INBOX_NAME=ECOMP-PORTAL-INBOX-DEV-LOCAL +fi + +if [ -z "${VID_UEB_APP_KEY}" ]; then + VID_UEB_APP_KEY=sYH0NJnsKmJC1B2A +fi + +if [ -z "${VID_UEB_APP_SECRET}" ]; then + VID_UEB_APP_SECRET=YOtknsT2wVFz9WISlSPDaAtd +fi + +if [ -z "${VID_UEB_APP_MAILBOX_NAME}" ]; then + VID_UEB_APP_MAILBOX_NAME="ECOMP-PORTAL-OUTBOX-90" +fi + +if [ -z "${VID_UEB_LISTENERS_ENABLE}" ]; then + VID_UEB_LISTENERS_ENABLE="false" +fi + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${BACKUP1_CONFIG_FILE} ]; then + cp -f ${BACKUP1_CONFIG_FILE} ${BACKUP2_CONFIG_FILE} || { + echo "ERROR: Could not copy ${BACKUP1_CONFIG_FILE} to ${BACKUP2_CONFIG_FILE}" + exit 2 + } +fi + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${FINAL_CONFIG_FILE} ]; then + cp -f ${FINAL_CONFIG_FILE} ${BACKUP1_CONFIG_FILE} || { + echo "ERROR: Could not copy ${FINAL_CONFIG_FILE} to ${BACKUP1_CONFIG_FILE}" + exit 3 + } +fi + +sed -e 's ${VID_WJ_LOGOUT_URL} '${VID_WJ_LOGOUT_URL}' g' \ + -e 's ${VID_ECOMP_REDIRECT_URL} '${VID_ECOMP_REDIRECT_URL}' g' \ + -e 's ${VID_ECOMP_REST_URL} '${VID_ECOMP_REST_URL}' g' \ + -e 's ${VID_UEB_URL_LIST} '${VID_UEB_URL_LIST}' g' \ + -e 's ${VID_ECOMP_PORTAL_INBOX_NAME} '${VID_ECOMP_PORTAL_INBOX_NAME}' g' \ + -e 's ${VID_UEB_APP_KEY} '${VID_UEB_APP_KEY}' g' \ + -e 's ${VID_UEB_APP_SECRET} '${VID_UEB_APP_SECRET}' g' \ + -e 's ${VID_UEB_APP_MAILBOX_NAME} '${VID_UEB_APP_MAILBOX_NAME}' g' \ + -e 's ${VID_UEB_LISTENERS_ENABLE} '${VID_UEB_LISTENERS_ENABLE}' g' \ + -e 's/${VID_UEB_CONSUMER_GROUP}/'${VID_UEB_CONSUMER_GROUP}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 4 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." diff --git a/vid/src/main/swm/common/localize_quartz.sh b/vid/src/main/swm/common/localize_quartz.sh new file mode 100644 index 00000000..30e37954 --- /dev/null +++ b/vid/src/main/swm/common/localize_quartz.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/quartz.properties +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/quartz_template.properties +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/quartz.properties.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/quartz.properties.bk.2 + +echo "Localizing the VID quartz configuration" + +if [ -z "${VID_MYSQL_HOST}" ]; then + VID_MYSQL_HOST=localhost +fi + +if [ -z "${VID_MYSQL_PORT}" ]; then + VID_MYSQL_PORT=3306 +fi + +if [ -z "${VID_MYSQL_DBNAME}" ]; then + VID_MYSQL_DBNAME=vid_portal +fi + +if [ -z "${VID_MYSQL_USER}" ]; then + VID_MYSQL_USER=$(id -un) +fi + +if [ -z "${VID_MYSQL_MAXCONNECTIONS}" ]; then + VID_MYSQL_MAXCONNECTIONS=5 +fi + +if [ -z "${VID_MYSQL_PASS}" ]; then + echo "Missing required parameter VID_MYSQL_PASS" + exit 1 +fi + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${BACKUP1_CONFIG_FILE} ]; then + cp -f ${BACKUP1_CONFIG_FILE} ${BACKUP2_CONFIG_FILE} || { + echo "ERROR: Could not copy ${BACKUP1_CONFIG_FILE} to ${BACKUP2_CONFIG_FILE}" + exit 2 + } +fi + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${FINAL_CONFIG_FILE} ]; then + cp -f ${FINAL_CONFIG_FILE} ${BACKUP1_CONFIG_FILE} || { + echo "ERROR: Could not copy ${FINAL_CONFIG_FILE} to ${BACKUP1_CONFIG_FILE}" + exit 3 + } +fi + +sed -e 's/${VID_MYSQL_HOST}/'${VID_MYSQL_HOST}'/g' \ + -e 's/${VID_MYSQL_PORT}/'${VID_MYSQL_PORT}'/g' \ + -e 's/${VID_MYSQL_DBNAME}/'${VID_MYSQL_DBNAME}'/g' \ + -e 's/${VID_MYSQL_USER}/'${VID_MYSQL_USER}'/g' \ + -e 's/${VID_MYSQL_PASS}/'${VID_MYSQL_PASS}'/g' \ + -e 's/${VID_MYSQL_MAXCONNECTIONS}/'${VID_MYSQL_MAXCONNECTIONS}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 4 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." + + diff --git a/vid/src/main/swm/common/localize_system.sh b/vid/src/main/swm/common/localize_system.sh new file mode 100644 index 00000000..ebd71076 --- /dev/null +++ b/vid/src/main/swm/common/localize_system.sh @@ -0,0 +1,178 @@ +#!/bin/bash + +FINAL_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/system.properties +TEMPLATE_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/system_template.properties +BACKUP1_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/system.properties.bk.1 +BACKUP2_CONFIG_FILE=${ROOT_DIR}/war/WEB-INF/conf/system.properties.bk.2 + +echo "Localizing the VID system configuration" + +if [ -z "${VID_MYSQL_HOST}" ]; then + VID_MYSQL_HOST=localhost +fi + +if [ -z "${VID_MYSQL_PORT}" ]; then + VID_MYSQL_PORT=3306 +fi + +if [ -z "${VID_MYSQL_DBNAME}" ]; then + VID_MYSQL_DBNAME=vid_portal +fi + +if [ -z "${VID_MYSQL_USER}" ]; then + VID_MYSQL_USER=vid_admin +fi + +if [ -z "${VID_MYSQL_MAXCONNECTIONS}" ]; then + VID_MYSQL_MAXCONNECTIONS=5 +fi + +if [ -z "${VID_AAI_HOST}" ]; then + VID_AAI_HOST=aai.api.openecomp.org +fi + +if [ -z "${VID_AAI_PORT}" ]; then + VID_AAI_PORT=8443 +fi + +if [ -z "${VID_APP_DISPLAY_NAME}" ]; then + VID_APP_DISPLAY_NAME=VID +fi + +if [ -z "${VID_ECOMP_SHARED_CONTEXT_REST_URL}" ]; then + VID_ECOMP_SHARED_CONTEXT_REST_URL="https://portal.openecomp.org:8080/ecompportal/context" +fi + +if [ -z "${VID_ECOMP_REDIRECT_URL}" ]; then + VID_ECOMP_REDIRECT_URL=https://portal.openecomp.org/ecompportal/ecompportal/process_csp +fi + +if [ -z "${VID_ECOMP_REST_URL}" ]; then + VID_ECOMP_REST_URL=https://portal.openecomp.org/ecompportal/auxapi +fi + +if [ -z "${VID_MSO_SERVER_URL}" ]; then + VID_MSO_SERVER_URL=https://mso.api.openecomp.org:8443 +fi + +if [ -z "${VID_TRUSTSTORE_FILE}" ]; then + VID_TRUSTSTORE_FILE=${ROOT_DIR}/etc/vid_keystore.jks +fi + +if [ -z "${VID_MYLOGIN_FEED_DIRECTORY}" ]; then + VID_MYLOGIN_FEED_DIRECTORY=/tmp/MyLogins +fi + +if [ -z "${VID_TRUSTSTORE_PASS}" ]; then + echo "ERROR: Missing required parameter VID_TRUSTSTORE_PASS" + exit 1 +fi + +if [ -z "${VID_MSO_USER}" ]; then + echo "ERROR: Missing required parameter VID_MSO_USER" + exit 1 +fi + +if [ -z "${VID_MSO_PASS}" ]; then + echo "ERROR: Missing required parameter VID_MSO_PASS"; + exit 1 +fi + +if [ -z "${VID_MYSQL_PASS}" ]; then + echo "ERROR: Missing required parameter VID_MYSQL_PASS" + exit 1 +fi + +if [ -z "${MSO_DME2_CLIENT_TIMEOUT}" ]; then + echo "ERROR: Missing required parameter MSO_DME2_CLIENT_TIMEOUT" + exit 1 +fi + +if [ -z "${MSO_DME2_CLIENT_READ_TIMEOUT}" ]; then + echo "ERROR: Missing required parameter MSO_DME2_CLIENT_READ_TIMEOUT" + exit 1 +fi + +if [ -z "${MSO_DME2_SERVER_URL}" ]; then + echo "ERROR: Missing required parameter MSO_DME2_SERVER_URL" + exit 1 +fi +if [ -z "${MSO_DME2_ENABLED}" ]; then + echo "ERROR: Missing required parameter MSO_DME2_ENABLED" + exit 1 +fi +if [ -z "${MSO_POLLING_INTERVAL_MSECS}" ]; then + MSO_POLLING_INTERVAL_MSECS=10000 +fi + +if [ -z "${AAI_TRUSTSTORE_FILENAME}" ]; then + AAI_TRUSTSTORE_FILENAME=tomcat_keystore +fi + +if [ -z "${AAI_TRUSTSTORE_PASSWD_X}" ]; then + AAI_TRUSTSTORE_PASSWD_X=70c87528c88dcd9f9c2558d30e817868 +fi + +if [ -z "${AAI_KEYSTORE_FILENAME}" ]; then + AAI_KEYSTORE_FILENAME=aai-client-cert.p12 +fi + +if [ -z "${AAI_KEYSTORE_PASSWD_X}" ]; then + AAI_KEYSTORE_PASSWD_X=70c87528c88dcd9f9c2558d30e817868 +fi + +mkdir -p "${VID_MYLOGIN_FEED_DIRECTORY}" + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${BACKUP1_CONFIG_FILE} ]; then + cp -f ${BACKUP1_CONFIG_FILE} ${BACKUP2_CONFIG_FILE} || { + echo "ERROR: Could not copy ${BACKUP1_CONFIG_FILE} to ${BACKUP2_CONFIG_FILE}" + exit 2 + } +fi + +#------------------------------------------------------------------------ +#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS +#------------------------------------------------------------------------ +if [ -f ${FINAL_CONFIG_FILE} ]; then + cp -f ${FINAL_CONFIG_FILE} ${BACKUP1_CONFIG_FILE} || { + echo "ERROR: Could not copy ${FINAL_CONFIG_FILE} to ${BACKUP1_CONFIG_FILE}" + exit 3 + } +fi + +sed -e 's/${VID_MYSQL_HOST}/'${VID_MYSQL_HOST}'/g' \ + -e 's/${VID_MYSQL_PORT}/'${VID_MYSQL_PORT}'/g' \ + -e 's/${VID_MYSQL_DBNAME}/'${VID_MYSQL_DBNAME}'/g' \ + -e 's/${VID_MYSQL_USER}/'${VID_MYSQL_USER}'/g' \ + -e 's/${VID_MYSQL_PASS}/'${VID_MYSQL_PASS}'/g' \ + -e 's/${VID_AAI_HOST}/'${VID_AAI_HOST}'/g' \ + -e 's/${VID_AAI_PORT}/'${VID_AAI_PORT}'/g' \ + -e 's,${AAI_TRUSTSTORE_FILENAME},'${AAI_TRUSTSTORE_FILENAME}',g' \ + -e 's/${AAI_TRUSTSTORE_PASSWD_X}/'${AAI_TRUSTSTORE_PASSWD_X}'/g' \ + -e 's,${AAI_KEYSTORE_FILENAME},'${AAI_KEYSTORE_FILENAME}',g' \ + -e 's/${AAI_KEYSTORE_PASSWD_X}/'${AAI_KEYSTORE_PASSWD_X}'/g' \ + -e 's/${VID_APP_DISPLAY_NAME}/'${VID_APP_DISPLAY_NAME}'/g' \ + -e 's ${VID_ECOMP_SHARED_CONTEXT_REST_URL} '${VID_ECOMP_SHARED_CONTEXT_REST_URL}' g' \ + -e 's ${VID_ECOMP_REDIRECT_URL} '${VID_ECOMP_REDIRECT_URL}' g' \ + -e 's ${VID_ECOMP_REST_URL} '${VID_ECOMP_REST_URL}' g' \ + -e 's ${VID_MSO_SERVER_URL} '${VID_MSO_SERVER_URL}' g' \ + -e 's/${VID_MSO_USER}/'${VID_MSO_USER}'/g' \ + -e 's/${VID_MSO_PASS}/'${VID_MSO_PASS}'/g' \ + -e 's,${VID_MYLOGIN_FEED_DIRECTORY},'${VID_MYLOGIN_FEED_DIRECTORY}',g' \ + -e 's,${MSO_DME2_CLIENT_TIMEOUT},'${MSO_DME2_CLIENT_TIMEOUT}',g' \ + -e 's,${MSO_DME2_CLIENT_READ_TIMEOUT},'${MSO_DME2_CLIENT_READ_TIMEOUT}',g' \ + -e 's,${MSO_DME2_SERVER_URL},'${MSO_DME2_SERVER_URL}',g' \ + -e 's,${MSO_DME2_ENABLED},'${MSO_DME2_ENABLED}',g' \ + -e 's,${MSO_POLLING_INTERVAL_MSECS},'${MSO_POLLING_INTERVAL_MSECS}',g' \ + -e 's,${VID_TRUSTSTORE_FILE},'${VID_TRUSTSTORE_FILE}',g' \ + -e 's/${VID_TRUSTSTORE_PASS}/'${VID_TRUSTSTORE_PASS}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || { + echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}" + exit 4 + } + +echo "Localized ${FINAL_CONFIG_FILE} successfully." + + |