diff --git a/backend/pyproject.toml b/backend/pyproject.toml index c95a8fe..6f6a872 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -10,6 +10,7 @@ dependencies = [ "certifi==2024.12.14 ; python_full_version >= '3.6'", "charset-normalizer==3.4.1 ; python_full_version >= '3.7'", "click==8.1.8 ; python_full_version >= '3.7'", + "dotenv>=0.9.9", "fastapi==0.115.7 ; python_full_version >= '3.8'", "fastapi-cli==0.0.7 ; python_full_version >= '3.8'", "h11==0.14.0 ; python_full_version >= '3.7'", diff --git a/backend/src/configuration/__init__.py b/backend/src/configuration/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/src/configuration/environment.py b/backend/src/configuration/environment.py new file mode 100644 index 0000000..a7625bb --- /dev/null +++ b/backend/src/configuration/environment.py @@ -0,0 +1,18 @@ +"""This module is for loading variables from the environment and passes them throughout the code using the Environment dataclass""" + +import os +from dataclasses import dataclass + +from dotenv import load_dotenv + + +# Load variables from environment +load_dotenv(override=True) + + +@dataclass +class Environment : + + supabase_url = os.environ['SUPABASE_URL'] + supabase_admin_key = os.environ['SUPABASE_ADMIN_KEY'] + supabase_test_user_id = os.environ['SUPABASE_TEST_USER_ID'] \ No newline at end of file diff --git a/backend/uv.lock b/backend/uv.lock index 0576fde..6fbf664 100644 --- a/backend/uv.lock +++ b/backend/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.12" [[package]] @@ -135,6 +135,7 @@ dependencies = [ { name = "certifi" }, { name = "charset-normalizer" }, { name = "click" }, + { name = "dotenv" }, { name = "fastapi" }, { name = "fastapi-cli" }, { name = "h11" }, @@ -188,6 +189,7 @@ requires-dist = [ { name = "certifi", marker = "python_full_version >= '3.6'", specifier = "==2024.12.14" }, { name = "charset-normalizer", marker = "python_full_version >= '3.7'", specifier = "==3.4.1" }, { name = "click", marker = "python_full_version >= '3.7'", specifier = "==8.1.8" }, + { name = "dotenv", specifier = ">=0.9.9" }, { name = "fastapi", marker = "python_full_version >= '3.8'", specifier = "==0.115.7" }, { name = "fastapi-cli", marker = "python_full_version >= '3.8'", specifier = "==0.0.7" }, { name = "h11", marker = "python_full_version >= '3.7'", specifier = "==0.14.0" }, @@ -414,6 +416,17 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/02/c3/253a89ee03fc9b9682f1541728eb66db7db22148cd94f89ab22528cd1e1b/deprecation-2.1.0-py2.py3-none-any.whl", hash = "sha256:a10811591210e1fb0e768a8c25517cabeabcba6f0bf96564f8ff45189f90b14a", size = 11178, upload-time = "2020-04-20T14:23:36.581Z" }, ] +[[package]] +name = "dotenv" +version = "0.9.9" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "python-dotenv" }, +] +wheels = [ + { url = "https://files.pythonhosted.org/packages/b2/b7/545d2c10c1fc15e48653c91efde329a790f2eecfbbf2bd16003b5db2bab0/dotenv-0.9.9-py2.py3-none-any.whl", hash = "sha256:29cf74a087b31dafdb5a446b6d7e11cbce8ed2741540e2339c69fbef92c94ce9", size = 1892, upload-time = "2025-02-19T22:15:01.647Z" }, +] + [[package]] name = "executing" version = "2.2.0"