-
Notifications
You must be signed in to change notification settings - Fork 6
/
configSemTK.sh
executable file
·37 lines (31 loc) · 1.06 KB
/
configSemTK.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#
# Configures SemTK services and webapps
#
# Usage: Run from any directory. First argument must be webapps install directory.
#
# Stop if any command goes bad
set -e
# Validate first argument
if [ "$#" -ne 1 ]; then
echo "Usage: ${BASH_SOURCE[0]} DIRECTORY"
exit 1
fi
WEBAPPS="$1"
if [ ! -d "${WEBAPPS}" ]; then
echo "WEBAPPS is not a valid directory: ${WEBAPPS}"
exit 1
fi
# DIR = directory holding this script
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd -P)"
cd "${DIR}"
# If SERVER_ADDRESS is not set, then set SERVER_ADDRESS to localhost
# before we source .env
export SERVER_ADDRESS="${SERVER_ADDRESS:-localhost}"
source .env
# Create an environment file containing the environment variables used
# in services' application.properties (this file is used at service
# startup via service.unit)
cat ./*Service/BOOT-INF/classes/application.properties | grep "{" | sed -e 's/^.*{\(.*\)}/\1=${\1}/' | sort | uniq | envsubst > environment
# Replace the js configuration files for the SemTK webapps
./configWebapps.sh "${WEBAPPS}"