-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use DAB to load dynaconf settings
- Loading branch information
Showing
20 changed files
with
1,081 additions
and
889 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
[pytest] | ||
asyncio_mode = auto | ||
DJANGO_SETTINGS_MODULE = aap_eda.settings.development | ||
env = | ||
EDA_MODE=development | ||
DJANGO_SETTINGS_MODULE = aap_eda.settings.default | ||
log_file_level = INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .default import * # noqa: F403 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
# Application definition | ||
INSTALLED_APPS = [ | ||
"daphne", | ||
"flags", | ||
# Django apps | ||
"django.contrib.auth", | ||
"django.contrib.contenttypes", | ||
"django.contrib.sessions", | ||
"django.contrib.staticfiles", | ||
# Third party apps | ||
"rest_framework", | ||
"drf_spectacular", | ||
"django_rq", | ||
"django_filters", | ||
"ansible_base.rbac", | ||
"ansible_base.resource_registry", | ||
"ansible_base.jwt_consumer", | ||
"ansible_base.rest_filters", | ||
"ansible_base.feature_flags", | ||
# Local apps | ||
"aap_eda.api", | ||
"aap_eda.core", | ||
] | ||
|
||
|
||
MIDDLEWARE = [ | ||
"django.middleware.security.SecurityMiddleware", | ||
"django.contrib.sessions.middleware.SessionMiddleware", | ||
"django.middleware.locale.LocaleMiddleware", | ||
"django.middleware.common.CommonMiddleware", | ||
"django.middleware.csrf.CsrfViewMiddleware", | ||
"django.contrib.auth.middleware.AuthenticationMiddleware", | ||
"django.middleware.clickjacking.XFrameOptionsMiddleware", | ||
"crum.CurrentRequestUserMiddleware", | ||
] | ||
|
||
ROOT_URLCONF = "aap_eda.urls" | ||
|
||
TEMPLATES = [ | ||
{ | ||
"BACKEND": "django.template.backends.django.DjangoTemplates", | ||
"DIRS": [], | ||
"APP_DIRS": True, | ||
"OPTIONS": { | ||
"context_processors": [ | ||
"django.template.context_processors.debug", | ||
"django.template.context_processors.request", | ||
"django.contrib.auth.context_processors.auth", | ||
], | ||
}, | ||
}, | ||
] | ||
|
||
WSGI_APPLICATION = "aap_eda.wsgi.application" | ||
|
||
ASGI_APPLICATION = "aap_eda.asgi.application" | ||
|
||
# Password validation | ||
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators | ||
|
||
AUTH_PASSWORD_VALIDATORS = [ | ||
{ | ||
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", # noqa: E501 | ||
}, | ||
{ | ||
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", # noqa: E501 | ||
}, | ||
{ | ||
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", # noqa: E501 | ||
}, | ||
{ | ||
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", # noqa: E501 | ||
}, | ||
] | ||
|
||
# Internationalization | ||
# https://docs.djangoproject.com/en/4.1/topics/i18n/ | ||
|
||
LANGUAGE_CODE = "en-us" | ||
|
||
USE_I18N = True | ||
|
||
TIME_ZONE = "UTC" | ||
|
||
USE_TZ = True | ||
|
||
# Default primary key field type | ||
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field | ||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" | ||
|
||
AUTH_USER_MODEL = "core.User" | ||
|
||
REST_FRAMEWORK = { | ||
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema", | ||
"DEFAULT_PAGINATION_CLASS": "aap_eda.api.pagination.DefaultPagination", | ||
"PAGE_SIZE": 20, | ||
"DEFAULT_AUTHENTICATION_CLASSES": [ | ||
"aap_eda.api.authentication.SessionAuthentication", | ||
"rest_framework.authentication.BasicAuthentication", | ||
"aap_eda.api.authentication.WebsocketJWTAuthentication", | ||
"ansible_base.jwt_consumer.eda.auth.EDAJWTAuthentication", | ||
], | ||
"DEFAULT_PERMISSION_CLASSES": [ | ||
"rest_framework.permissions.IsAuthenticated", | ||
"ansible_base.rbac.api.permissions.AnsibleBaseObjectPermissions", | ||
], | ||
"TEST_REQUEST_DEFAULT_FORMAT": "json", | ||
"DEFAULT_METADATA_CLASS": "aap_eda.api.metadata.EDAMetadata", | ||
"EXCEPTION_HANDLER": "aap_eda.api.exceptions.api_fallback_handler", | ||
} | ||
|
||
DEFAULT_REDIS_DB = 0 | ||
|
||
# --------------------------------------------------------- | ||
# TASKING SETTINGS | ||
# --------------------------------------------------------- | ||
RQ = { | ||
"JOB_CLASS": "aap_eda.core.tasking.Job", | ||
"QUEUE_CLASS": "aap_eda.core.tasking.Queue", | ||
"SCHEDULER_CLASS": "aap_eda.core.tasking.Scheduler", | ||
"WORKER_CLASS": "aap_eda.core.tasking.Worker", | ||
} | ||
|
||
# Time window in seconds to consider a worker as dead | ||
DEFAULT_WORKER_HEARTBEAT_TIMEOUT = 60 | ||
DEFAULT_WORKER_TTL = 5 | ||
|
||
RQ_STARTUP_JOBS = [] | ||
|
||
# Id of the scheduler job it's required when we have multiple instances of | ||
# the scheduler running to avoid duplicate jobs | ||
RQ_PERIODIC_JOBS = [ | ||
{ | ||
"func": ( | ||
"aap_eda.tasks.orchestrator.enqueue_monitor_rulebook_processes" | ||
), | ||
"interval": 5, | ||
"id": "enqueue_monitor_rulebook_processes", | ||
}, | ||
{ | ||
"func": "aap_eda.tasks.project.monitor_project_tasks", | ||
"interval": 30, | ||
"id": "monitor_project_tasks", | ||
}, | ||
] | ||
RQ_CRON_JOBS = [] | ||
|
||
ANSIBLE_BASE_CUSTOM_VIEW_PARENT = "aap_eda.api.views.dab_base.BaseAPIView" | ||
|
||
# --------------------------------------------------------- | ||
# DJANGO ANSIBLE BASE RESOURCES REGISTRY SETTINGS | ||
# --------------------------------------------------------- | ||
ANSIBLE_BASE_RESOURCE_CONFIG_MODULE = "aap_eda.api.resource_api" | ||
|
||
# --------------------------------------------------------- | ||
# DJANGO ANSIBLE BASE RBAC SETTINGS | ||
# --------------------------------------------------------- | ||
DEFAULT_ORGANIZATION_NAME = "Default" | ||
ANSIBLE_BASE_SERVICE_PREFIX = "eda" | ||
ANSIBLE_BASE_TEAM_MODEL = "core.Team" | ||
ANSIBLE_BASE_ORGANIZATION_MODEL = "core.Organization" | ||
|
||
# Organization and object roles will come from create_initial_data | ||
ANSIBLE_BASE_ROLE_PRECREATE = {} | ||
|
||
ANSIBLE_BASE_ALLOW_SINGLETON_USER_ROLES = True | ||
ANSIBLE_BASE_CHECK_RELATED_PERMISSIONS = ["view"] | ||
|
||
DEFAULT_SYSTEM_PG_NOTIFY_CREDENTIAL_NAME = "_DEFAULT_EDA_PG_NOTIFY_CREDS" |
Oops, something went wrong.