From 9f155a62e27a2c7bae5347723fee5f3499d1cc28 Mon Sep 17 00:00:00 2001 From: derneuere <faridani.rad@gmail.com> Date: Sun, 27 Mar 2022 14:07:59 +0200 Subject: [PATCH] Remove secret key --- backend/entrypoint.sh | 17 +++++++++++++++++ librephotos.env | 5 +---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/backend/entrypoint.sh b/backend/entrypoint.sh index e8eceaf..ff943eb 100755 --- a/backend/entrypoint.sh +++ b/backend/entrypoint.sh @@ -2,6 +2,23 @@ export PYTHONUNBUFFERED=TRUE export PYTHONFAULTHANDLER=1 mkdir -p /logs +if [ -n "$SECRET_KEY" ] +then + echo "Use env SECRET_KEY" +else + if [ -f /logs/secret.key ] + then + echo "Use existing secret.key" + SECRET_KEY=`cat /logs/secret.key` + export SECRET_KEY=$SECRET_KEY + else + echo "Create new secret.key" + SECRET_KEY=$(python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())') + echo $SECRET_KEY > /logs/secret.key + export SECRET_KEY=$SECRET_KEY + fi +fi + python image_similarity/main.py 2>&1 | tee /logs/gunicorn_image_similarity.log & python manage.py showmigrations | tee /logs/show_migrate.log python manage.py migrate | tee /logs/command_migrate.log diff --git a/librephotos.env b/librephotos.env index 0486e0f..11c0c2d 100644 --- a/librephotos.env +++ b/librephotos.env @@ -10,9 +10,6 @@ myPhotos=./librephotos/pictures # Internal data of LibrePhotos data=./librephotos/data -# Secret Key. Get one here https://rb.gy/emgmwo (Shortened random.org link) -shhhhKey=D2VymuMn2gAhx4tmAawd - # ------------------------------------------------------------------------------------------------ # Wow, we are at the optional now. Pretty easy so far. You do not have to change any of the below. @@ -21,7 +18,7 @@ shhhhKey=D2VymuMn2gAhx4tmAawd httpPort=3000 # What branch should we install the latest weekly build or the development branch (dev) -tag=latest +tag=dev # Number of workers, which take care of the request to the api. This setting can dramatically affect the ram usage. # A positive integer generally in the 2-4 x $(NUM_CORES) range. -- GitLab