feat(demo): add isolated demo environments
This commit is contained in:
@@ -2,6 +2,7 @@ import os
|
||||
from datetime import timedelta
|
||||
from pathlib import Path
|
||||
|
||||
from celery.schedules import crontab
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
@@ -48,6 +49,7 @@ LOCAL_APPS = [
|
||||
"apps.notifications",
|
||||
"apps.reports",
|
||||
"apps.logs",
|
||||
"apps.demos",
|
||||
]
|
||||
|
||||
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
|
||||
@@ -138,6 +140,7 @@ REST_FRAMEWORK = {
|
||||
"otp_send_sustained": "10/day",
|
||||
"login_password": "5/10m",
|
||||
"login_otp": "5/10m",
|
||||
"demo_start": os.getenv("DEMO_START_RATE_LIMIT", "10/hour"),
|
||||
},
|
||||
"EXCEPTION_HANDLER": "core.exceptions.handlers.exception_handler",
|
||||
}
|
||||
@@ -243,7 +246,21 @@ NOTIFICATION_TOAST_LEVELS = tuple(
|
||||
|
||||
REPORT_EXPORT_RETENTION_DAYS = int(os.getenv("REPORT_EXPORT_RETENTION_DAYS", "7"))
|
||||
|
||||
CELERY_IMPORTS = ("apps.users.tasks", "apps.notifications.tasks", "apps.reports.tasks")
|
||||
DEMO_ENABLED = os.getenv("DEMO_ENABLED", "True") == "True"
|
||||
DEMO_ENVIRONMENT_TTL_HOURS = int(os.getenv("DEMO_ENVIRONMENT_TTL_HOURS", "24"))
|
||||
DEMO_CLEANUP_BATCH_SIZE = int(os.getenv("DEMO_CLEANUP_BATCH_SIZE", "100"))
|
||||
|
||||
CELERY_IMPORTS = ("apps.users.tasks", "apps.notifications.tasks", "apps.reports.tasks", "apps.demos.tasks")
|
||||
CELERY_BEAT_SCHEDULE = {
|
||||
"reports-cleanup-expired-exports": {
|
||||
"task": "reports.cleanup_expired_exports",
|
||||
"schedule": crontab(minute=0, hour="*/6"),
|
||||
},
|
||||
"demos-cleanup-expired-environments": {
|
||||
"task": "demos.cleanup_expired_environments",
|
||||
"schedule": crontab(minute=0, hour="*"),
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
STORAGES = {
|
||||
|
||||
@@ -24,6 +24,7 @@ urlpatterns = [
|
||||
path("api/notifications/", include("apps.notifications.api.urls"), name="notifications"),
|
||||
path("api/reports/", include("apps.reports.api.urls"), name="reports"),
|
||||
path("api/logs/", include("apps.logs.api.urls"), name="logs"),
|
||||
path("api/demo/", include("apps.demos.api.urls"), name="demos"),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
|
||||
Reference in New Issue
Block a user