Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 [open-zaak/open-zaak#1629] Add generic base settings file #19

Merged
merged 3 commits into from
May 17, 2024

Conversation

stevenbal
Copy link
Contributor

@stevenbal stevenbal commented May 1, 2024

Related issue: open-zaak/open-zaak#1629

A first attempt at making a generic base.py settings file. I used the settings from Open Zaak as a template and implemented it first in Objecttypes: maykinmedia/objecttypes-api#102. This base.py will be extended as I add this to the other projects.

@stevenbal stevenbal changed the title ➕ [#14] Add django-log-outgoing-requests to deps 🔧 [open-zaak/open-zaak#1629] Add generic base settings file May 1, 2024
@stevenbal stevenbal marked this pull request as draft May 1, 2024 10:17
@stevenbal stevenbal force-pushed the feature/django-settings branch 3 times, most recently from 997a6d7 to 9e24806 Compare May 7, 2024 11:39
@stevenbal stevenbal force-pushed the feature/django-settings branch 2 times, most recently from eaa69f3 to 5a05d60 Compare May 7, 2024 12:34
@stevenbal stevenbal marked this pull request as ready for review May 7, 2024 12:39
Comment on lines +650 to +651
if config("DISABLE_2FA", default=False): # pragma: no cover
MAYKIN_2FA_ALLOW_MFA_BYPASS_BACKENDS = AUTHENTICATION_BACKENDS
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% sure if we want this here, OF only has this in dev.py, but that way you wouldn't be able to disable 2FA for docker containers locally for example.

@annashamray thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed it with Sjoerd for Objects API and he said that some test instances of Objects API and Objecttypes API don't use 2FA, therefore we added it into base.py

Since we don't have different docker images for test and prod environments, I think it would be nice to be able to disable it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, then I'll leave it in there 👍

Copy link
Contributor

@annashamray annashamray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add the list of env vars supported by this lib?
Maybe we could have RTD published in the future and link it in other API docs

# Build paths inside the project, so further paths can be defined relative to
# the code root.
DJANGO_PROJECT_DIR = get_django_project_dir()
BASE_DIR = os.path.abspath(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move from os.path to Pathlib?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a good idea 👍

open_api_framework/conf/base.py Outdated Show resolved Hide resolved
"django_admin_index",
"django.contrib.admin",
# External applications.
"axes",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the apps be ordered alphabetically within semantic groups? It would be neater, but we can live without it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could do this, but I'm not sure if order matters when it comes to these apps (two_factor and maykin_2fa for instance)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let's leave it as it is

open_api_framework/conf/base.py Outdated Show resolved Hide resolved
open_api_framework/conf/base.py Show resolved Hide resolved
open_api_framework/conf/base.py Outdated Show resolved Hide resolved
@stevenbal
Copy link
Contributor Author

stevenbal commented May 10, 2024

Could you add the list of env vars supported by this lib?

@annashamray I left this out of scope for this PR, I want to tackle this as part of open-zaak/open-zaak#1649 by generating documentation from our usage of config(...) to avoid having to manually add this documentation for each component

* remove unused lines
* replace os usage with pathlib
@stevenbal stevenbal merged commit 7d0c97d into main May 17, 2024
9 checks passed
@stevenbal stevenbal deleted the feature/django-settings branch August 15, 2024 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants