Skip to content

Commit

Permalink
Masking compare config
Browse files Browse the repository at this point in the history
  • Loading branch information
wlongabaugh committed Oct 5, 2022
1 parent 8ccdd07 commit cdd9fe4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
25 changes: 22 additions & 3 deletions shell/compareConfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ TMP_VERS=$(mktemp /tmp/vers.XXXXXXXXX)
TMP_SORT=$(mktemp /tmp/sort.XXXXXXXXX)
TMP_CURR=$(mktemp /tmp/curr.XXXXXXXXX)
TMP_LAST=$(mktemp /tmp/last.XXXXXXXXX)
TMP_DIFF=$(mktemp /tmp/diff.XXXXXXXXX)

cat < /dev/null > ${TMP_VERS}
VERS=`gsutil ls -a ${CONFIG_PATH}`
Expand All @@ -23,7 +24,7 @@ VER_LEN=`cat ${TMP_VERS} | wc -l`

if (( ${VER_LEN} < 2 )); then
echo "No diff: first version for " ${CONFIG_PATH}
rm -f ${TMP_VERS} ${TMP_SORT} ${TMP_CURR} ${TMP_LAST}
rm -f ${TMP_VERS} ${TMP_SORT} ${TMP_CURR} ${TMP_LAST} ${TMP_DIFF}
exit
fi

Expand All @@ -46,7 +47,25 @@ gsutil cp ${CONFIG_PATH}"#"${PENULT} ${TMP_LAST} > /dev/null 2>&1
gsutil cp ${CONFIG_PATH}"#"${CURR} ${TMP_CURR} > /dev/null 2>&1

echo "Diff of previous (" ${PEN_STR} ") to current (" ${CURR_STR} ") for" ${CONFIG_PATH} ":"
diff ${TMP_LAST} ${TMP_CURR}
diff ${TMP_LAST} ${TMP_CURR} > ${TMP_DIFF}
while read -r LINE; do
CHECK_LINE_PASS=`echo ${LINE} | grep -q "PASSWORD"`
if [ -n `echo "${LINE}" | grep -iq "PASSWORD"` ]; then
echo "PASSWORD REDACTED"
elif [ -n `echo "${LINE}" | grep -iq "SECRET"` ]; then
echo "SECRET REDACTED"
elif [ -n `echo "${LINE}" | grep -iq "KEY"` ]; then
echo "KEY REDACTED"
elif [ -n `echo "${LINE}" | grep -iq "TOKEN"` ]; then
echo "TOKEN REDACTED"
elif [ -n `echo "${LINE}" | grep -iq "DICOM"` ]; then
echo "DICOM REDACTED"
else
echo "${LINE}"
fi

trap 'rm -f ${TMP_VERS} ${TMP_SORT} ${TMP_CURR} ${TMP_LAST}' EXIT
done < ${TMP_DIFF}


trap 'rm -f ${TMP_VERS} ${TMP_SORT} ${TMP_CURR} ${TMP_LAST} ${TMP_DIFF}' EXIT

2 changes: 1 addition & 1 deletion shell/gcloud-pull-staging-files.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mkdir ./json
mkdir ./txt

gsutil cp "gs://${DEPLOYMENT_BUCKET}/${WEBAPP_APP_YAML}" ./app.yaml
gsutil cp "gs://${DEPLOYMENT_BUCKET}/${ENV_FILE}" ./.env

gsutil cp "gs://${DEPLOYMENT_BUCKET}/${WEBAPP_RUNTIME_SA_KEY}" ./privatekey.json
gsutil cp "gs://${DEPLOYMENT_BUCKET}/solr-ssl.pem" ./solr-ssl.pem

Expand Down

0 comments on commit cdd9fe4

Please sign in to comment.