diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..ad9275ac --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +FUNCTIONS_ENDPOINT_URL= #firebase functions url (Firebase emulator or production Cloud Run URL) \ No newline at end of file diff --git a/app/main.py b/app/main.py index 0635c724..62dc885e 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/app/routes/session.py b/app/routes/session.py index 1db18593..354a000f 100644 --- a/app/routes/session.py +++ b/app/routes/session.py @@ -133,12 +133,13 @@ def calib_results(): "screen_width": screen_width, "k": k } - - RUXAILAB_WEBHOOK_URL = "https://receivecalibration-ffptzpxikq-uc.a.run.app" + + FUNCTIONS_ENDPOINT_URL = os.getenv('FUNCTIONS_ENDPOINT_URL') + 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) diff --git a/requirements.txt b/requirements.txt index 72c46fb4..4fa362a1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,3 +30,4 @@ threadpoolctl==3.6.0 tzdata==2025.2 urllib3==2.7.0 Werkzeug==3.1.3 +dotenv==0.9.9 \ No newline at end of file