File tree Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Expand file tree Collapse file tree 2 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ SPRING_DOCKER_IMAGE=pivotalrabbitmq/spring-authorization-server:0.0.6
4+
5+ ensure_spring () {
6+ if docker ps | grep spring & > /dev/null; then
7+ print " spring already running ..."
8+ else
9+ start_spring
10+ fi
11+ }
12+ init_spring () {
13+ SPRING_CONFIG_DIR=${TEST_CONFIG_PATH} /spring
14+ SPRING_URL=${SPRING_URL:- $OAUTH_PROVIDER_URL }
15+
16+ print " > SPRING_CONFIG_DIR: ${SPRING_CONFIG_DIR} "
17+ print " > SPRING_URL: ${SPRING_URL} "
18+ print " > SPRING_DOCKER_IMAGE: ${SPRING_DOCKER_IMAGE} "
19+
20+ generate-ca-server-client-kpi spring $SPRING_CONFIG_DIR
21+ generate-server-keystore-if-required spring $SPRING_CONFIG_DIR
22+ }
23+ start_spring () {
24+ begin " Starting spring ..."
25+
26+ init_spring
27+ kill_container_if_exist spring
28+
29+ MOUNT_SPRING_CONF_DIR=$CONF_DIR /spring
30+
31+ mkdir -p $MOUNT_SPRING_CONF_DIR
32+ ${BIN_DIR} /gen-spring-yml ${SPRING_CONFIG_DIR} $ENV_FILE $MOUNT_SPRING_CONF_DIR /application.yml
33+ print " > EFFECTIVE SPRING_CONFIG_FILE: $MOUNT_SPRING_CONF_DIR /application.yml"
34+ cp ${SPRING_CONFIG_DIR} /* .pem $MOUNT_SPRING_CONF_DIR
35+ cp ${SPRING_CONFIG_DIR} /* .jks $MOUNT_SPRING_CONF_DIR
36+
37+ docker run \
38+ --detach \
39+ --name spring \
40+ --net ${DOCKER_NETWORK} \
41+ --publish 8080:8080 \
42+ --publish 8443:8443 \
43+ -v ${MOUNT_SPRING_CONF_DIR} :/config \
44+ ${SPRING_DOCKER_IMAGE}
45+
46+ wait_for_oidc_endpoint spring $SPRING_URL $MOUNT_SPRING_CONF_DIR /ca_spring_certificate.pem
47+ end " spring is ready"
48+
49+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ SCRIPT=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
3+
4+ # set -x
5+
6+ SPRING_PATH=${1:? First parameter is the directory env and config files are relative to}
7+ ENV_FILE=${2:? Second parameter is a comma-separated list of .env file which has exported template variables}
8+ FINAL_CONFIG_FILE=${3:? Forth parameter is the name of the final config file. It is relative to where this script is run from}
9+
10+ source $ENV_FILE
11+
12+ parentdir=" $( dirname " $FINAL_CONFIG_FILE " ) "
13+ mkdir -p $parentdir
14+
15+ echo " " > $FINAL_CONFIG_FILE
16+
17+ for f in $( $SCRIPT /find-template-files " ${PROFILES} " $SPRING_PATH " application" " yml" )
18+ do
19+ envsubst < $f >> $FINAL_CONFIG_FILE
20+ done
You can’t perform that action at this time.
0 commit comments