build(env): extract Redis URL into env file

This could allow one to connect to a remote Redis instance with a powerful GPU, allowing one to offload the NLP work.
This commit is contained in:
2026-03-22 14:41:15 +00:00
parent 97e897c240
commit 7716ee0bff
2 changed files with 13 additions and 3 deletions

View File

@@ -18,5 +18,10 @@ HF_HOME=/models/huggingface
TRANSFORMERS_CACHE=/models/huggingface TRANSFORMERS_CACHE=/models/huggingface
TORCH_HOME=/models/torch TORCH_HOME=/models/torch
# Frontend # URLs
FRONTEND_URL=http://localhost:5173 FRONTEND_URL=http://localhost:5173
BACKEND_URL=http://backend:5000
REDIS_URL=redis://redis:6379/0
# API & Scraping
MAX_FETCH_LIMIT=1000

View File

@@ -1,10 +1,15 @@
from celery import Celery from celery import Celery
from dotenv import load_dotenv
from server.utils import get_env
load_dotenv()
REDIS_URL = get_env("REDIS_URL")
def create_celery(): def create_celery():
celery = Celery( celery = Celery(
"ethnograph", "ethnograph",
broker="redis://redis:6379/0", broker=REDIS_URL,
backend="redis://redis:6379/0", backend=REDIS_URL,
) )
celery.conf.task_serializer = "json" celery.conf.task_serializer = "json"
celery.conf.result_serializer = "json" celery.conf.result_serializer = "json"