Skip to content

Commit

Permalink
Merge branch 'master' into feature/invite_users
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Dobbelaere committed Nov 27, 2023
2 parents b325c97 + 9bea722 commit 3618115
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ jobs:
build:
runs-on: ubuntu-latest
name: Test OneSilaHeadless
services:
postgres:
image: postgres:12
env:
POSTGRES_USER: fake
POSTGRES_PASSWORD: fake
POSTGRES_DB: fake
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
Expand All @@ -14,6 +33,14 @@ jobs:
- name: Install requirements
run: pip install -r requirements.txt
- name: Run tests and collect coverage
env:
POSTGRES_HOST: localhost
POSTGRES_USER: fake
POSTGRES_PASSWORD: fake
POSTGRES_DB: fake
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
REDIS_HOST: localhost
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
run: cd OneSila && coverage run --source='.' manage.py test
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v3
Expand Down
6 changes: 5 additions & 1 deletion OneSila/OneSila/settings/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import socket
from .base import *
from .local import *

try:
from .local import *
except ModuleNotFoundError:
pass
31 changes: 30 additions & 1 deletion OneSila/OneSila/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
from pathlib import Path
from django.utils.translation import gettext_lazy as _
from operator import itemgetter
import os

SECRET_KEY = "FAKE-KEY-DONT-KEEP-THIS-YOU-SHOULD-SET-A-NEW-ONE"

BASE_DIR = Path(__file__).resolve().parent.parent

Expand Down Expand Up @@ -87,6 +89,18 @@
ASGI_APPLICATION = 'OneSila.asgi.application'


DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.getenv('POSTGRES_DB', 'fake'),
'USER': os.getenv('POSTGRES_USER', 'fake'),
'PASSWORD': os.getenv('POSTGRES_PASSWORD', 'fake'),
'HOST': os.getenv('POSTGRES_HOST', 'localhost'),
'PORT': '5432',
}
}


# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators

Expand Down Expand Up @@ -138,6 +152,8 @@
# Strawberry graphql settings
#

STRAWBERRY_DJANGO_REGISTER_USER_AUTO_LOGIN = False

STRAWBERRY_DJANGO = {
"FIELD_DESCRIPTION_FROM_HELP_TEXT": True,
"TYPE_DESCRIPTION_FROM_MODEL_DOCSTRING": True,
Expand All @@ -149,7 +165,7 @@
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("127.0.0.1", 6379)],
"hosts": [(os.getenv('REDIS_HOST', "127.0.0.1"), os.getenv('REDIS_PORT', 6379))],
},
},
}
Expand All @@ -159,3 +175,16 @@
#

CORS_ALLOW_CREDENTIALS = True

CORS_ALLOWED_ORIGINS = [
'*',
# 'http://172.19.250.107:3000',
]

CORS_ALLOWED_HEADERS = [
'*'
]

CORS_ALLOWED_METHODS = [
'*'
]

0 comments on commit 3618115

Please sign in to comment.