diff --git a/backend/src/constants.py b/backend/src/constants.py index 3e07f453..fd8d73c8 100644 --- a/backend/src/constants.py +++ b/backend/src/constants.py @@ -6,7 +6,15 @@ PROD = os.getenv("PROD", "False") == "True" # 8001 emulates the data server -BACKEND_URL = "https://api.statbotics.io" if PROD else "http://localhost:8001" +# The ETL self-trigger (update_curr_year_background and the freshness-ping probe) +# HTTP-calls BACKEND_URL to reach the data router. When the data router runs as a +# separate service the default is right, but a single-container deploy (e.g. a +# staging mirror serving all routers from one service) must point BACKEND_URL at +# its OWN backend, or the self-trigger hits the wrong host and ingestion never +# runs. Read it from the environment, falling back to the original default. +BACKEND_URL = os.getenv("BACKEND_URL") or ( + "https://api.statbotics.io" if PROD else "http://localhost:8001" +) # DB