Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FUNCTIONS_ENDPOINT_URL= #firebase functions url (Firebase emulator or production Cloud Run URL)
USE_EMULATORS=true #true if running locally
3 changes: 2 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
8 changes: 6 additions & 2 deletions app/routes/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ tzdata==2025.2
Werkzeug==3.1.3
gunicorn==23.0.0
requests==2.31.0
dotenv==0.9.9