Skip to content

Commit

Permalink
adjusts app settings
Browse files Browse the repository at this point in the history
  • Loading branch information
hugobessa committed Nov 9, 2024
1 parent dc82dbe commit 31a6651
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,5 @@ omit = [
]

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "tests.settings"
python_files = ["test_*.py"]
addopts = "--dist=loadscope"
9 changes: 9 additions & 0 deletions vintasend/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
],
"NOTIFICATION_BACKEND": "vintasend_django.services.notification_backends.django_db_notification_backend.DjangoDbNotificationBackend",
"NOTIFICATION_MODEL": "vintasend_django.models.Notification",
"NOTIFICATION_DEFAULT_BCC_EMAILS": [],
"NOTIFICATION_DEFAULT_BASE_URL_PROTOCOL": "http",
"NOTIFICATION_DEFAULT_BASE_URL_DOMAIN": "example.com",
}


Expand Down Expand Up @@ -93,11 +96,17 @@ class NotificationSettings:
NOTIFICATION_ADAPTERS: list[tuple[str, str]]
NOTIFICATION_BACKEND: str
NOTIFICATION_MODEL: str | None
NOTIFICATION_DEFAULT_BCC_EMAILS: list[str]
NOTIFICATION_DEFAULT_BASE_URL_PROTOCOL: str
NOTIFICATION_DEFAULT_BASE_URL_DOMAIN: str

def __init__(self):
self.NOTIFICATION_ADAPTERS = get_config("NOTIFICATION_ADAPTERS")
self.NOTIFICATION_BACKEND = get_config("NOTIFICATION_BACKEND")
self.NOTIFICATION_MODEL = get_config("NOTIFICATION_MODEL")
self.NOTIFICATION_DEFAULT_BCC_EMAILS = get_config("NOTIFICATION_DEFAULT_BCC_EMAILS")
self.NOTIFICATION_DEFAULT_BASE_URL_PROTOCOL = get_config("NOTIFICATION_DEFAULT_BASE_URL_PROTOCOL")
self.NOTIFICATION_DEFAULT_BASE_URL_DOMAIN = get_config("NOTIFICATION_DEFAULT_BASE_URL_DOMAIN")

def get_notification_model_cls(self):
module_name, class_name = self.NOTIFICATION_MODEL.rsplit(".", 1)
Expand Down

0 comments on commit 31a6651

Please sign in to comment.