Skip to content

Commit

Permalink
midna: move db config to env
Browse files Browse the repository at this point in the history
  • Loading branch information
darakeon committed Jul 15, 2023
1 parent da25fbf commit 866cb49
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
6 changes: 6 additions & 0 deletions midna/env/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ DJANGO_SUPERUSER_USERNAME=username
DJANGO_SUPERUSER_EMAIL=email
DJANGO_SUPERUSER_PASSWORD=password

DATABASE_NAME=dfm
DATABASE_USER=dfm_user
DATABASE_PASS=
DATABASE_HOST=172.17.0.1
DATABASE_PORT=3306

AWS_BUCKET=
AWS_DEFAULT_REGION=
AWS_ACCESS_KEY_ID=
Expand Down
10 changes: 5 additions & 5 deletions midna/src/midna/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@
},
'mysql': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'dfm',
'USER': 'dfm_user',
'PASSWORD': '',
'HOST': '172.17.0.1',
'PORT': '3306',
'NAME': environ['DATABASE_NAME'],
'USER': environ['DATABASE_USER'],
'PASSWORD': environ['DATABASE_PASS'],
'HOST': environ['DATABASE_HOST'],
'PORT': environ['DATABASE_PORT'],
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"
}
Expand Down
8 changes: 7 additions & 1 deletion publish/dfm-midna.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ WORKDIR /var/midna/src
RUN mkdir /var/midna/static
RUN mkdir /var/midna/static/inside
RUN mkdir /var/midna/static/outside
RUN SECRET_KEY=temp python3 manage.py collectstatic
RUN SECRET_KEY=collectstatic \
DATABASE_NAME= \
DATABASE_USER= \
DATABASE_PASS= \
DATABASE_HOST= \
DATABASE_PORT= \
python3 manage.py collectstatic

CMD cp -r ../static/inside/* ../static/outside && gunicorn -c ../config/prod.py

0 comments on commit 866cb49

Please sign in to comment.