Skip to content

Commit

Permalink
updated Settings of auth_service and user_managment settings Locate t…
Browse files Browse the repository at this point in the history
…he line where SECRET_KEY is defined.
  • Loading branch information
Abbas Toof committed Jun 17, 2024
1 parent b76cc03 commit 7346935
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 28 deletions.
34 changes: 10 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name: CI Pipeline
# Events that trigger the workflow
on:
push:
branches: [ main, develop ] # Trigger on push to main and develop branches
branches: [ main, develop, mtoof ] # Trigger on push to main, develop, and mtoof branches
pull_request:
branches: [ main, develop ] # Trigger on pull request to main and develop branches
branches: [ main, develop, mtoof ] # Trigger on pull request to main, develop, and mtoof branches

# Define jobs in the workflow
jobs:
Expand All @@ -31,28 +31,6 @@ jobs:
python -m pip install --upgrade pip # Upgrade pip
pip install -r requirements.txt # Install dependencies from requirements.txt
# test:
# needs: setup
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v3

# - name: Set up Python 3.11
# uses: actions/setup-python@v3
# with:
# python-version: 3.11

# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r requirements.txt

# # Run test suite
# - name: Run tests
# run: |
# pytest # Execute tests using pytest

security:
needs: setup
runs-on: ubuntu-latest
Expand All @@ -70,6 +48,10 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
# Set environment variables for security checks
- name: Set environment variables
run: echo "DJANGO_SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }}" >> $GITHUB_ENV

# Run security checks
- name: Run security checks
run: |
Expand All @@ -93,6 +75,10 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
# Set environment variables for Docker build
- name: Set environment variables
run: echo "DJANGO_SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }}" >> $GITHUB_ENV

# Build the Docker image
- name: Build Docker image
run: |
Expand Down
4 changes: 3 additions & 1 deletion Backend/auth_service/auth_service/auth_service/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
from pathlib import Path
from datetime import timedelta
from django.core.management.utils import get_random_secret_key

RABBITMQ_HOST = os.getenv('RABBITMQ_HOST')
RABBITMQ_USER = os.getenv('RABBITMQ_USER')
Expand All @@ -27,7 +28,8 @@
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-woftd2en2**zr(b%#*2vit2v%s@(k54gb^c(ots0abo7(wsmo%'
# SECRET_KEY = 'django-insecure-woftd2en2**zr(b%#*2vit2v%s@(k54gb^c(ots0abo7(wsmo%'
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', get_random_secret_key())

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
from pathlib import Path
from datetime import timedelta
from django.core.management.utils import get_random_secret_key

RABBITMQ_HOST = os.getenv('RABBITMQ_HOST')
RABBITMQ_USER = os.getenv('RABBITMQ_USER')
Expand All @@ -27,8 +28,8 @@
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-qn48+qe6b*r3p65fb_3fo)_rji73yxoz7++45o773!k2jkvq0v'

# SECRET_KEY = 'django-insecure-qn48+qe6b*r3p65fb_3fo)_rji73yxoz7++45o773!k2jkvq0v'
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', get_random_secret_key())
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

Expand Down Expand Up @@ -154,4 +155,4 @@

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
CORS_ORIGIN_ALLOW_ALL = True
AUTH_USER_MODEL = 'users.User'
AUTH_USER_MODEL = 'users.User'

0 comments on commit 7346935

Please sign in to comment.