From bbe40da8433e484e386b285243ea2adcbe27ead1 Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Fri, 6 Oct 2023 18:12:27 +0100 Subject: [PATCH 1/4] coverage router should not be here --- openbb_platform/platform/core/openbb_core/api/rest_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbb_platform/platform/core/openbb_core/api/rest_api.py b/openbb_platform/platform/core/openbb_core/api/rest_api.py index 5c4a59ab14e..641b91b9a29 100644 --- a/openbb_platform/platform/core/openbb_core/api/rest_api.py +++ b/openbb_platform/platform/core/openbb_core/api/rest_api.py @@ -39,7 +39,7 @@ AppLoader.from_routers( app=app, routers=[AuthService().router, router_system, router_coverage, router_commands] if Env().DEV_MODE - else [router_coverage, router_commands], + else [router_commands], prefix="/api/v1", ) From 65ecfd75aa7c1929368328f84de617873acbb917 Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Fri, 6 Oct 2023 18:19:20 +0100 Subject: [PATCH 2/4] update docker readme --- openbb_platform/platform/core/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openbb_platform/platform/core/README.md b/openbb_platform/platform/core/README.md index c59b71275ad..54a66cec891 100644 --- a/openbb_platform/platform/core/README.md +++ b/openbb_platform/platform/core/README.md @@ -454,13 +454,13 @@ We provide a `.dockerfile`` in OpenBB [repo](https://github.com/OpenBB-finance/O To build the image, you can run the following command from the repo root: ```bash -docker build -f build/docker/api.dockerfile -t openbb-sdk:latest . +docker build -f build/docker/api.dockerfile -t openbb-platform:latest . ``` To run this newly-built image: ```bash -docker run --rm -p 8000:8000 -v ~/.openbb_platform:/root/.openbb_platform openbb-sdk:latest +docker run --rm -p 8000:8000 -v ~/.openbb_platform:/root/.openbb_platform openbb-platform:latest ``` This will mount the local `~/.openbb_platform` directory into the Docker container so you can use the API keys from there and it will expose the API on port `8000`. From 59fcce4466fcf7322f1e5520a2dcd652f9d12ea0 Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Fri, 6 Oct 2023 18:22:38 +0100 Subject: [PATCH 3/4] forgot to check auth here --- openbb_platform/platform/core/openbb_core/api/auth/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openbb_platform/platform/core/openbb_core/api/auth/user.py b/openbb_platform/platform/core/openbb_core/api/auth/user.py index 9328024650c..dab13cca5a9 100644 --- a/openbb_platform/platform/core/openbb_core/api/auth/user.py +++ b/openbb_platform/platform/core/openbb_core/api/auth/user.py @@ -8,7 +8,7 @@ from openbb_core.app.service.user_service import UserService from openbb_core.env import Env from typing_extensions import Annotated -security = HTTPBasic() +security = HTTPBasic() if Env().API_AUTH else lambda: None async def authenticate_user( From 66f9ffd845300db3b3636cb1fc770a7d3e2e105f Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Fri, 6 Oct 2023 18:24:33 +0100 Subject: [PATCH 4/4] update docstrings and readme --- openbb_platform/platform/core/README.md | 2 +- openbb_platform/platform/core/openbb_core/env.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openbb_platform/platform/core/README.md b/openbb_platform/platform/core/README.md index 54a66cec891..473e75121ec 100644 --- a/openbb_platform/platform/core/README.md +++ b/openbb_platform/platform/core/README.md @@ -355,7 +355,7 @@ To apply an environment variable use one of the following: The variables we use are: -- `OPENBB_API_AUTH`: enables API authentication for command endpoints +- `OPENBB_API_AUTH`: enables API endpoint authentication - `OPENBB_API_USERNAME`: sets API username - `OPENBB_API_PASSWORD`: sets API password - `OPENBB_API_AUTH_EXTENSION`: specifies which authentication extension to use diff --git a/openbb_platform/platform/core/openbb_core/env.py b/openbb_platform/platform/core/openbb_core/env.py index 02c89b3fca8..3ce1ed909ba 100644 --- a/openbb_platform/platform/core/openbb_core/env.py +++ b/openbb_platform/platform/core/openbb_core/env.py @@ -19,7 +19,7 @@ class Env(metaclass=SingletonMeta): @property def API_AUTH(self) -> bool: - """API authentication: enables commands authentication in FastAPI""" + """API authentication: enables API endpoint authentication""" return self.str2bool(self._environ.get("OPENBB_API_AUTH", False)) @property