From 99ae19994a6f2654e92d445d3e3f926d68fdf562 Mon Sep 17 00:00:00 2001 From: Philipp Rouast Date: Sat, 6 Jul 2024 16:52:39 +0200 Subject: [PATCH] Inject development API_URL when required --- .github/workflows/main.yml | 3 +++ pyproject.toml | 1 + vitallens/constants.py | 8 +++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ca08d4a..72f5d12 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,6 +32,9 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install ".[test]" + - name: Set API_URL for development branch + if: github.ref == 'refs/heads/development' + run: echo "API_URL=https://api.rouast.com/vitallens-dev" >> $GITHUB_ENV - name: Lint with flake8 run: | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics diff --git a/pyproject.toml b/pyproject.toml index 9bda575..44f809f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ dependencies = [ "numpy", "onnxruntime", "prpy[ffmpeg,numpy_min]>=0.2.7", + "python-dotenv", "pyyaml", "requests", ] diff --git a/vitallens/constants.py b/vitallens/constants.py index 4e60cd7..6f29acd 100644 --- a/vitallens/constants.py +++ b/vitallens/constants.py @@ -18,6 +18,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from dotenv import load_dotenv +import os +load_dotenv() + SECONDS_PER_MINUTE = 60.0 # Minima and maxima of derived vitals @@ -30,7 +34,9 @@ API_MIN_FRAMES = 16 API_MAX_FRAMES = 900 API_OVERLAP = 30 -API_URL = "https://api.rouast.com/vitallens-dev" +API_URL = "https://api.rouast.com/vitallens-v1" +if 'API_URL' in os.environ: + API_URL = os.getenv('API_URL') # Disclaimer message DISCLAIMER = "The provided values are estimates and should be interpreted according to the provided confidence levels ranging from 0 to 1. The VitalLens API is not a medical device and its estimates are not intended for any medical purposes."