Skip to content

Commit

Permalink
updated yaml file
Browse files Browse the repository at this point in the history
  • Loading branch information
Reeya123 committed Jul 12, 2024
1 parent bc2f2f0 commit 8658c85
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
34 changes: 20 additions & 14 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,27 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Create secrets file
run: |
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> .env
echo "DJANGO_GOOGLE_OAUTH2_CLIENT_ID=${{ secrets.DJANGO_GOOGLE_OAUTH2_CLIENT_ID }}" >> .env
echo "DJANGO_GOOGLE_OAUTH2_CLIENT_SECRET=${{ secrets.DJANGO_GOOGLE_OAUTH2_CLIENT_SECRET }}" >> .env
echo "DJANGO_ORCID_OAUTH2_CLIENT_URL=${{ secrets.DJANGO_ORCID_OAUTH2_CLIENT_URL }}" >> .env
echo "DJANGO_ORCID_OAUTH2_CLIENT_ID=${{ secrets.DJANGO_ORCID_OAUTH2_CLIENT_ID }}" >> .env
echo "DJANGO_ORCID_OAUTH2_CLIENT_SECRET=${{ secrets.DJANGO_ORCID_OAUTH2_CLIENT_SECRET }}" >> .env
echo "DJANGO_ORCID_OAUTH2_URL=${{ secrets.DJANGO_ORCID_OAUTH2_URL }}" >> .env
echo "SERVER_VERSION=${{ secrets.SERVER_VERSION }}" >> .env
echo "SERVER_URL=${{ secrets.SERVER_URL }}" >> .env
echo "DATABASE=${{ secrets.DATABASE }}" >> .env
echo "EMAIL_BACKEND=${{ secrets.EMAIL_BACKEND }}" >> .env
echo "SECRET_KEY=${{ secrets.SECRET_KEY }}" >> server/.env
echo "DJANGO_GOOGLE_OAUTH2_CLIENT_ID=${{ secrets.DJANGO_GOOGLE_OAUTH2_CLIENT_ID }}" >> server/.env
echo "DJANGO_GOOGLE_OAUTH2_CLIENT_SECRET=${{ secrets.DJANGO_GOOGLE_OAUTH2_CLIENT_SECRET }}" >> server/.env
echo "DJANGO_ORCID_OAUTH2_CLIENT_URL=${{ secrets.DJANGO_ORCID_OAUTH2_CLIENT_URL }}" >> server/.env
echo "DJANGO_ORCID_OAUTH2_CLIENT_ID=${{ secrets.DJANGO_ORCID_OAUTH2_CLIENT_ID }}" >> server/.env
echo "DJANGO_ORCID_OAUTH2_CLIENT_SECRET=${{ secrets.DJANGO_ORCID_OAUTH2_CLIENT_SECRET }}" >> server/.env
echo "DJANGO_ORCID_OAUTH2_URL=${{ secrets.DJANGO_ORCID_OAUTH2_URL }}" >> server/.env
echo "SERVER_VERSION=${{ secrets.SERVER_VERSION }}" >> server/.env
echo "SERVER_URL=${{ secrets.SERVER_URL }}" >> server/.env
echo "DATABASE=${{ secrets.DATABASE }}" >> server/.env
echo "EMAIL_BACKEND=${{ secrets.EMAIL_BACKEND }}" >> server/.env
- name: Debug Secrets
run: |
cat .env
cat server/.env
- name: Export Environment Variables
run: |
export $(cat server/.env | xargs)
shell: bash

- name: Install Dependencies
run: |
Expand All @@ -59,11 +65,11 @@ jobs:
EMAIL_BACKEND: ${{ secrets.EMAIL_BACKEND }}
run: |
cd server # Change to the subdirectory
cp ../.env . # Copy the .env file to the server directory
python3.9 manage.py test
- name: Clean up
run: |
rm .env
rm server/.env
3 changes: 3 additions & 0 deletions server/portaluserdb/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"SERVER_URL": os.environ.get("SERVER_URL"),
"DATABASE": os.environ.get("DATABASE"),
"EMAIL_BACKEND": os.environ.get("EMAIL_BACKEND", "django.core.mail.backends.console.EmailBackend"),

},
}
if secrets["DJANGO_KEYS"]["SECRET_KEY"] == None:
Expand Down Expand Up @@ -81,6 +82,8 @@

# Use print statements for debugging
print(f"Secrets: {secrets}")
print(f"EMAIL_BACKEND: {EMAIL_BACKEND}")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

Expand Down

0 comments on commit 8658c85

Please sign in to comment.