diff prod/setup.sh @ 328:1f0ff7540734

USASR-4075 Forcing Unique Admin Password
author aldrich@ssdt-ohio.org
date Wed, 04 Dec 2019 11:57:48 +0000
parents 2ae65177f74e
children e36bf4191e25
line wrap: on
line diff
--- a/prod/setup.sh	Tue Nov 12 16:16:00 2019 +0000
+++ b/prod/setup.sh	Wed Dec 04 11:57:48 2019 +0000
@@ -7,7 +7,7 @@
 #
 # Will create a docker-compose.yml and .env file with default settings.
 #
-# 
+#  Updated December 2019 to generate random admin passwords
 source "$(dirname "${BASH_SOURCE[0]}")/../scripts/.functions.sh"
 
 md5calc() {
@@ -80,12 +80,14 @@
     then    
         echo "  usasdata:" >> ./docker-compose.yml
         [ "$USAS_DB_PASSWORD" == "" ] && echo "USAS_DB_PASSWORD=$(genDBHash)" >> ./.env
+		[ "$USAS_ADMIN_PASSWORD" == "" ] &&  echo "USAS_ADMIN_PASSWORD=$(genDBHash)" >> ./.env
     fi
     
     if [ ! "$usps" == "" ]
     then
       echo "  uspsdata:" >> ./docker-compose.yml
       [ "$USPS_DB_PASSWORD" == "" ] &&  echo "USPS_DB_PASSWORD=$(genDBHash)" >> ./.env
+	  [ "$USPS_ADMIN_PASSWORD" == "" ] &&  echo "USPS_ADMIN_PASSWORD=$(genDBHash)" >> ./.env
     fi
     
     echo "" >> ./docker-compose.yml
@@ -101,10 +103,30 @@
            Move customizations to docker-compose.override.yml then delete the docker-compose.yml
 "
 fi
-    
+##Only creates a docker-compose.override.yml if one does not already exist.
 if [ ! -e "docker-compose.override.yml" ] 
 then 
-   echo 'version: "3.3"' >> docker-compose.override.yml   
+   echo 'version: "3.3"' >> docker-compose.override.yml  
+   echo 'services:' >> docker-compose.override.yml   
+##usas admin components
+if [ ! "$usas" == "" ]
+    then
+   echo '  usasapp:' >> docker-compose.override.yml
+   echo '    environment:' >> docker-compose.override.yml
+   echo '      - APPLICATION_ADMIN_PASSWORD=${USAS_ADMIN_PASSWORD}' >> docker-compose.override.yml
+   echo '      - APPLICATION_ADMIN_RESET=true' >> docker-compose.override.yml
+
+fi
+##usps admin components
+if [ ! "$usps" == "" ]
+    then
+   echo '  uspsapp:' >> docker-compose.override.yml
+   echo '    environment:' >> docker-compose.override.yml
+   echo '      - APPLICATION_ADMIN_PASSWORD=${USPS_ADMIN_PASSWORD}' >> docker-compose.override.yml
+   echo '      - APPLICATION_ADMIN_RESET=true' >> docker-compose.override.yml
+
+fi
+##end of entire if statments for docker-compose.override.yml
 fi
     
 if [ "$USAS_APPLICATIONID" == "" ]