From 998b20c4a09785b54e1d9760a31cfbd4d82364a8 Mon Sep 17 00:00:00 2001 From: Philipp Rouast Date: Sat, 6 Jul 2024 16:47:48 +0200 Subject: [PATCH] Read API_URL from environment variable if exists --- pyproject.toml | 1 + vitallens/constants.py | 6 ++++++ 2 files changed, 7 insertions(+) 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 5e57fd8..d33de4b 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 @@ -31,3 +35,5 @@ API_MAX_FRAMES = 900 API_OVERLAP = 30 API_URL = "https://api.rouast.com/vitallens-v1" +if 'API_URL' in os.environ: + API_URL = os.getenv('API_URL')