Skip to content

Commit

Permalink
Configured Github workflows to use CI settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van der Schoor committed Jan 2, 2023
1 parent 2c2d721 commit a0ebd51
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
python src/manage.py collectstatic --noinput --link
coverage run src/manage.py test src
env:
DJANGO_SETTINGS_MODULE: open_inwoner.conf.dev
DJANGO_SETTINGS_MODULE: open_inwoner.conf.ci
SECRET_KEY: dummy
DB_USER: postgres
DB_PASSWORD: ''
Expand Down
51 changes: 44 additions & 7 deletions src/open_inwoner/conf/ci.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import warnings

os.environ.setdefault("DEBUG", "no")
os.environ.setdefault("ENVIRONMENT", "ci")
Expand All @@ -8,7 +9,6 @@

from .base import * # noqa isort:skip


LOGGING["loggers"].update(
{
"django": {
Expand All @@ -19,12 +19,49 @@
}
)

CACHES.update(
{
"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"},
# See: https://github.com/jazzband/django-axes/blob/master/docs/configuration.rst#cache-problems
"axes": {"BACKEND": "django.core.cache.backends.dummy.DummyCache"},
"oidc": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"},
}
)

# in memory cache and django-axes don't get along.
# https://django-axes.readthedocs.io/en/latest/configuration.html#known-configuration-problems
CACHES = {
"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"},
"axes": {"BACKEND": "django.core.cache.backends.dummy.DummyCache"},
}
# Allow logging in with both username+password and email+password
AUTHENTICATION_BACKENDS = [
"open_inwoner.accounts.backends.CustomAxesBackend",
"open_inwoner.accounts.backends.UserModelEmailBackend",
"django.contrib.auth.backends.ModelBackend",
# mock login like dev.py
"digid_eherkenning.mock.backends.DigiDBackend",
"open_inwoner.accounts.backends.CustomOIDCBackend",
]

ELASTIC_APM["DEBUG"] = True

ELASTICSEARCH_DSL_AUTO_REFRESH = False
ELASTICSEARCH_DSL_AUTOSYNC = False
ES_INDEX_PRODUCTS = "products_test"

ENVIRONMENT = "CI"

#
# Django-axes
#
AXES_BEHIND_REVERSE_PROXY = False

# Django privates
SENDFILE_BACKEND = "django_sendfile.backends.development"

# Two factor auth
TWO_FACTOR_FORCE_OTP_ADMIN = False
TWO_FACTOR_PATCH_ADMIN = False

# THOU SHALT NOT USE NAIVE DATETIMES
warnings.filterwarnings(
"error",
r"DateTimeField .* received a naive datetime",
RuntimeWarning,
r"django\.db\.models\.fields",
)

0 comments on commit a0ebd51

Please sign in to comment.