mirror of
https://github.com/FunnyWolf/agentic-soc-platform.git
synced 2026-08-22 13:12:56 +02:00
Remove hidden runtime environment overrides
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
+1
-1
Submodule asf-doc updated: e23d69b4c5...174fc37949
@@ -4,7 +4,6 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
UV_LINK_MODE=copy \
|
||||
DJANGO_SETTINGS_MODULE=asp.settings \
|
||||
ASP_CUSTOM_DIR=/app/custom \
|
||||
PYTHONPATH=/opt/asp/custom-packages:/app/custom
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -92,20 +92,10 @@ def get_runtime_config():
|
||||
|
||||
|
||||
def get_prompt_language():
|
||||
from django.conf import settings
|
||||
|
||||
override = getattr(settings, "AGENTIC_PROMPT_LANGUAGE", None)
|
||||
if override:
|
||||
return str(override).strip().lower()
|
||||
return get_runtime_config()["prompt_language"]
|
||||
|
||||
|
||||
def get_stream_maxlen():
|
||||
from django.conf import settings
|
||||
|
||||
override = getattr(settings, "WEBHOOK_REDIS_STREAM_MAXLEN", None)
|
||||
if override is not None:
|
||||
return int(override)
|
||||
try:
|
||||
return get_runtime_config()["stream_maxlen"]
|
||||
except Exception as exc:
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
from unittest.mock import patch
|
||||
|
||||
from django.test import SimpleTestCase, override_settings
|
||||
from django.test import SimpleTestCase, TestCase
|
||||
from django.urls import Resolver404, resolve
|
||||
from rest_framework.test import APIClient
|
||||
|
||||
from apps.settings.models import RuntimeConfig
|
||||
from apps.settings.runtime_config import invalidate
|
||||
from apps.webhook.schemas import WebhookResult
|
||||
from apps.webhook.service import (
|
||||
WebhookRedisError,
|
||||
@@ -26,9 +28,15 @@ class FailingRedisClient:
|
||||
raise RuntimeError("redis unavailable")
|
||||
|
||||
|
||||
class WebhookServiceTests(SimpleTestCase):
|
||||
@override_settings(WEBHOOK_REDIS_STREAM_MAXLEN=123)
|
||||
class WebhookServiceTests(TestCase):
|
||||
def set_stream_maxlen(self, value):
|
||||
config = RuntimeConfig.get_current()
|
||||
config.stream_maxlen = value
|
||||
config.save(update_fields=["stream_maxlen", "updated_at"])
|
||||
invalidate("runtime")
|
||||
|
||||
def test_handle_splunk_webhook_writes_result_to_search_stream(self):
|
||||
self.set_stream_maxlen(123)
|
||||
redis_client = FakeRedisClient()
|
||||
|
||||
result = handle_splunk_webhook(
|
||||
@@ -49,8 +57,8 @@ class WebhookServiceTests(SimpleTestCase):
|
||||
with self.assertRaisesMessage(ValueError, "search_name is required."):
|
||||
handle_splunk_webhook({"search_name": " ", "result": {}}, redis_client=FakeRedisClient())
|
||||
|
||||
@override_settings(WEBHOOK_REDIS_STREAM_MAXLEN=456)
|
||||
def test_handle_kibana_webhook_writes_normalized_sources(self):
|
||||
self.set_stream_maxlen(456)
|
||||
redis_client = FakeRedisClient()
|
||||
|
||||
result = handle_kibana_webhook(
|
||||
|
||||
@@ -12,7 +12,7 @@ from apps.common.logging import (
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
load_dotenv(BASE_DIR / ".env")
|
||||
CUSTOM_DIR = Path(os.environ.get("ASP_CUSTOM_DIR", BASE_DIR / "custom"))
|
||||
CUSTOM_DIR = BASE_DIR / "custom"
|
||||
|
||||
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY", "dev-secret-key-change-in-prod-32-byte-minimum")
|
||||
DEBUG = os.environ.get("DJANGO_DEBUG", "false").lower() == "true"
|
||||
|
||||
@@ -3,7 +3,6 @@ x-asp-backend: &asp-backend
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
ASP_CUSTOM_DIR: /app/custom
|
||||
PYTHONPATH: /opt/asp/custom-packages:/app/custom
|
||||
volumes:
|
||||
- ./custom:/app/custom
|
||||
|
||||
Reference in New Issue
Block a user