From 5ba5ec4f4bd57cad77f66b2bb03c7662b06b7242 Mon Sep 17 00:00:00 2001 From: shay Date: Fri, 17 Apr 2026 17:07:12 -0400 Subject: [PATCH] feat(edge): scaffold config, requirements, Dockerfile --- edge/Dockerfile | 9 +++++++++ edge/pytest.ini | 5 +++++ edge/requirements.txt | 7 +++++++ edge/src/config.py | 9 +++++++++ 4 files changed, 30 insertions(+) create mode 100644 edge/Dockerfile create mode 100644 edge/pytest.ini create mode 100644 edge/requirements.txt create mode 100644 edge/src/config.py diff --git a/edge/Dockerfile b/edge/Dockerfile new file mode 100644 index 0000000..e23d1fd --- /dev/null +++ b/edge/Dockerfile @@ -0,0 +1,9 @@ +FROM python:3.11-slim + +WORKDIR /app +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt +COPY src ./src + +EXPOSE 5003 +CMD ["gunicorn", "-b", "0.0.0.0:5003", "-w", "2", "src.api:app"] diff --git a/edge/pytest.ini b/edge/pytest.ini new file mode 100644 index 0000000..9d1efdb --- /dev/null +++ b/edge/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +testpaths = tests +python_files = test_*.py +pythonpath = . +addopts = -ra --strict-markers diff --git a/edge/requirements.txt b/edge/requirements.txt new file mode 100644 index 0000000..2a644ec --- /dev/null +++ b/edge/requirements.txt @@ -0,0 +1,7 @@ +flask==3.0.3 +flask-caching==2.3.0 +flask-compress==1.15 +requests==2.32.3 +pytest==8.3.3 +responses==0.25.3 +gunicorn==23.0.0 diff --git a/edge/src/config.py b/edge/src/config.py new file mode 100644 index 0000000..c771baf --- /dev/null +++ b/edge/src/config.py @@ -0,0 +1,9 @@ +import os + +PORT = int(os.getenv("EDGE_PORT", "5003")) +GENERATOR_URL = os.getenv("GENERATOR_URL", "http://localhost:5002") +CACHE_TYPE = os.getenv("CACHE_TYPE", "SimpleCache") +CACHE_REDIS_URL = os.getenv("CACHE_REDIS_URL", "") +CACHE_DEFAULT_TIMEOUT = int(os.getenv("CACHE_DEFAULT_TIMEOUT", "86400")) +CACHE_THRESHOLD = int(os.getenv("CACHE_THRESHOLD", "10000")) +UPSTREAM_TIMEOUT = int(os.getenv("EDGE_UPSTREAM_TIMEOUT", "10"))