summaryrefslogtreecommitdiffstats
path: root/pre-push.sh
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2020-06-20 15:43:28 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2020-06-20 16:51:07 +0100
commite697466557b7ec370a0bd424a33b84074e41d564 (patch)
tree37bf6f095ccf281fb864a4a7947f21a36c315894 /pre-push.sh
parentb35a0b0d26303e61e20b320db9358ae425c49933 (diff)
downloadtroggle-e697466557b7ec370a0bd424a33b84074e41d564.tar.gz
troggle-e697466557b7ec370a0bd424a33b84074e41d564.tar.bz2
troggle-e697466557b7ec370a0bd424a33b84074e41d564.zip
Cleanup secrets management, pre-run checks.
Diffstat (limited to 'pre-push.sh')
-rw-r--r--pre-push.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/pre-push.sh b/pre-push.sh
new file mode 100644
index 0000000..8e3b244
--- /dev/null
+++ b/pre-push.sh
@@ -0,0 +1,33 @@
+#! /bin/sh
+# create and sanitise files for pushing to repo
+# Philip Sargent 2020/06/20
+echo deprecations.
+python -Wall manage.py check -v 3 2>deprecations.txt >/dev/null
+echo diffsettings.
+python manage.py diffsettings | grep "###" > diffsettings.txt
+echo pip freeze.
+pip freeze > requirements.txt
+echo inspectdb.
+python manage.py inspectdb > troggle-inspectdb.py
+#egrep -in "unable|error" troggle-inspectdb.py
+echo remove passwords.
+cp localsettings.py localsettingsWSL.py
+grep EXPOUSERPASS localsettings*.py
+sed -i '/EXPOUSERPASS/ s/^.*$/EXPOUSERPASS = "nnn:gggggg"/' localsettings*.py
+sed -i '/EXPOUSERPASS/ s/^.*$/EXPOUSERPASS = "nnn:gggggg"/' diffsettings.txt
+echo " " reset: EXPOUSERPASS = \"nnn:gggggg\"
+grep EMAIL_HOST_PASSWORD localsettings*.py
+sed -i '/EMAIL_HOST_PASSWORD/ s/^.*$/EMAIL_HOST_PASSWORD = "insert-real-email-password-here"/' localsettings*.py
+sed -i '/EMAIL_HOST_PASSWORD/ s/^.*$/EMAIL_HOST_PASSWORD = "insert-real-email-password-here"/' diffsettings.txt
+echo " " reset: EMAIL_HOST_PASSWORD = \"insert-real-email-password-here\"
+grep SECRET_KEY *settings.*
+sed -i '/SECRET_KEY/ s/^.*$/SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"/' settings.py
+sed -i '/SECRET_KEY/ s/^.*$/SECRET_KEY = "not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2"/' diffsettings.txt
+echo " " reset: SECRET_KEY = \"not-the-real-secret-key-a#vaeozn0---^fj!355qki*vj2\"
+#
+# Do these before final testing, *not* just before pushing:
+# python reset-django.py
+# python manage.py makemigrations
+# python manage.py test
+# python manage.py inspectdb > troggle-inspectdb.py
+# egrep -i "unable|error" troggle-inspectdb.py