From 5e63d27174f75823c1ef102a5b12f4cafdeda6e9 Mon Sep 17 00:00:00 2001 From: Soham Date: Sun, 8 Feb 2026 09:04:27 +0530 Subject: [PATCH 1/2] Remove : hardcoded RUXAILAB_WEBHOOK_URL var --- .env.example | 2 ++ app/routes/session.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..d76e017 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +FUNCTIONS_ENDPOINT_URL= #firebase functions url (Firebase emulator or production Cloud Run URL) +USE_EMULATORS=true #true if running locally diff --git a/app/routes/session.py b/app/routes/session.py index 1db1859..fb65629 100644 --- a/app/routes/session.py +++ b/app/routes/session.py @@ -133,12 +133,16 @@ def calib_results(): "screen_width": screen_width, "k": k } + + USE_EMULATORS=os.getenv('USE_EMULATORS') + FUNCTIONS_ENDPOINT_URL = os.getenv('FUNCTIONS_ENDPOINT_URL') - RUXAILAB_WEBHOOK_URL = "https://receivecalibration-ffptzpxikq-uc.a.run.app" + if USE_EMULATORS: + FUNCTIONS_ENDPOINT_URL+='/receiveCalibration' print("file_name:", file_name) - resp = requests.post(RUXAILAB_WEBHOOK_URL, json=payload) + resp = requests.post(FUNCTIONS_ENDPOINT_URL, json=payload) print("Enviado para RuxaiLab:", resp.status_code, resp.text) except Exception as e: print("Erro ao enviar para RuxaiLab:", e) From a8a4bb7149c33dcaa459d867e3e284487e48a73b Mon Sep 17 00:00:00 2001 From: Soham Date: Sun, 8 Feb 2026 09:06:15 +0530 Subject: [PATCH 2/2] Add : dotenv to requirements.txt --- app/main.py | 3 ++- requirements.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index 0635c72..62dc885 100644 --- a/app/main.py +++ b/app/main.py @@ -3,7 +3,8 @@ # Local imports from app from app.routes import session as session_route - +from dotenv import load_dotenv +load_dotenv() # Initialize Flask app and enable CORS app = Flask(__name__) diff --git a/requirements.txt b/requirements.txt index 69429c3..22c1ee5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,3 +18,4 @@ tzdata==2025.2 Werkzeug==3.1.3 gunicorn==23.0.0 requests==2.31.0 +dotenv==0.9.9