Mercurial > public > ssdt-docker
comparison compose2/preview/setup.sh @ 132:a095257a342b
DEP-12: add auto-config of initial integration keys
author | smith@nwoca.org |
---|---|
date | Mon, 08 May 2017 22:13:40 +0100 |
parents | bf5f8acc35f2 |
children | 48c5b742016c |
comparison
equal
deleted
inserted
replaced
131:70ec01165f8e | 132:a095257a342b |
---|---|
9 # | 9 # |
10 # | 10 # |
11 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/.functions.sh" | 11 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/.functions.sh" |
12 | 12 |
13 base=$(dirname "${BASH_SOURCE[0]}") | 13 base=$(dirname "${BASH_SOURCE[0]}") |
14 default_name=$(basename $PWD) | |
14 | 15 |
15 echo "Preparing '$(basename $PWD)' with default USxS configuration" | 16 echo "Preparing '$(basename $PWD)' with default USxS configuration" |
16 | 17 |
17 if [ ! -e "docker-compose.yml" ] ; then | |
18 cp $base/usxs-template.yml ./docker-compose.yml | |
19 echo "created docker-compose.yml" | |
20 fi | |
21 | |
22 touch .env | 18 touch .env |
23 | |
24 source .env | 19 source .env |
25 | 20 |
26 if [ "$COMPOSE_PROJECT_NAME" == "" ] | 21 if [ "$COMPOSE_PROJECT_NAME" == "" ] |
27 then | 22 then |
28 echo "COMPOSE_PROJECT_NAME=$(basename $PWD)" >> .env | 23 read -e -p "Enter project name: <${default_name}> " answer |
24 project_name=${answer:-$default_name} | |
25 echo "COMPOSE_PROJECT_NAME=${project_name}" >> .env | |
29 echo "set project name in .env file" | 26 echo "set project name in .env file" |
30 source .env | 27 source .env |
31 fi | 28 fi |
32 | 29 |
30 if [ ! -e "docker-compose.yml" ] ; then | |
31 cp $base/usxs-template.yml ./docker-compose.yml | |
32 echo "created default docker-compose.yml" | |
33 fi | |
34 | |
35 if [ "$USAS_MODULE_USPSINTEGRATION_CONFIGURATION_USPSCONFIGURATION_APPLICATIONID" == "" ] | |
36 then | |
37 read -e -p "Generate USAS and USPS integration config? <Y/n> " answer | |
38 case $answer in | |
39 y | Y | yes | YES ) answer="y";; | |
40 n | N | no | NO ) answer="n";; | |
41 *) answer="y" | |
42 esac | |
43 if [ "$answer" == "y" ] | |
44 then | |
45 usas_id=${COMPOSE_PROJECT_NAME}-usas | |
46 usas_key=$(openssl rand -hex 32) | |
47 usps_id=${COMPOSE_PROJECT_NAME}-usps | |
48 usps_key=$(openssl rand -hex 32) | |
49 echo "USAS_APPLICATIONID=${usas_id}" >> .env | |
50 echo "USAS_APIKEY=$usas_key" >> .env | |
51 echo "USPS_APPLICATIONID=${usps_id}" >> .env | |
52 echo "USPS_APIKEY=$usps_key" >> .env | |
53 echo "Created integration API keys. Enable integration modules after applications startup" | |
54 fi | |
55 fi | |
56 | |
33 echo "project '$COMPOSE_PROJECT_NAME' ready with default values. Review or create a docker-compose.override.yml for custom settings." | 57 echo "project '$COMPOSE_PROJECT_NAME' ready with default values. Review or create a docker-compose.override.yml for custom settings." |
58 |