Skip to content

Commit daeabce

Browse files
author
Kirill_Lekhov
committed
Fix srta v4
1 parent 90c1493 commit daeabce

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

django_spinproject/modules/gitlab_ci.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from ._base import BaseModule
2-
from .gitlab_ci_data import _V1_ENV, _V2_ENV, _V3_ENV, _V4_ENV, _V5_ENV
2+
from .gitlab_ci_data import _V1_ENV, _V2_ENV, _V3_ENV, _V4_ENV
33
from ..project.project_info import ProjectInfo
44

55

django_spinproject/modules/srta_data/v4.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@
4141
if [ ! -e $MAIN_FOLDER/.env ]; then
4242
# Copy template
4343
cp $MAIN_FOLDER/.env.example $MAIN_FOLDER/.env
44-
SECRET=$(poetry run python3 -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())")
45-
sed -i 's|DJANGO_SECRET_KEY=""|DJANGO_SECRET_KEY="'${SECRET//&/\\\\&}'"|g' $MAIN_FOLDER/.env
44+
SECRET="$(poetry run python3 -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())")"
45+
# The $ symbol is replaced because django-environ is trying to read the value of an environment variable
46+
SAFE_SECRET=`printf "%s" "$SECRET" | sed 's/\\\\\\$/~/g' | sed 's/\\\\\\\\/\\\\\\\\\\\\\\\\/g' | sed 's/\\\\&/\\\\\\\\&/g'`
47+
sed -i 's|DJANGO_SECRET_KEY=""|DJANGO_SECRET_KEY="'$SAFE_SECRET'"|g' $MAIN_FOLDER/.env
4648
# Show
4749
cat $MAIN_FOLDER/.env
4850
echo ".env has been autogenerated, to edit: $ nano $MAIN_FOLDER/.env"

0 commit comments

Comments
 (0)