Skip to content

Commit

Permalink
Add MYSQL_HOST environment variable and update database configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
FeloxleF committed Mar 16, 2024
1 parent 512fa1e commit d1f0652
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
matrix:
python-version: [3.9]


env:
MYSQL_HOST: mysql
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
7 changes: 5 additions & 2 deletions activmindback/activmindback/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
https://docs.djangoproject.com/en/4.2/ref/settings/
"""

import os
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
Expand Down Expand Up @@ -81,6 +82,8 @@
# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases

MYSQL_HOST = os.environ.get('MYSQL_HOST', 'localhost')

DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
Expand All @@ -89,7 +92,7 @@
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'activmind',
'HOST': '127.0.0.1',
'HOST': MYSQL_HOST,
'USER': 'root',
'PASSWORD': 'root',
'OPTIONS': {
Expand All @@ -101,7 +104,7 @@
'test': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'activmind_test',
'HOST': 'mysql',
'HOST': MYSQL_HOST,
'USER': 'root',
'PASSWORD': 'root',
'OPTIONS': {
Expand Down

0 comments on commit d1f0652

Please sign in to comment.