Merge branch 'feature/openbb-sdk-v4' into feature/integration-testing

This commit is contained in:
hjoaquim
2023-10-07 15:53:48 +01:00
4 changed files with 6 additions and 6 deletions

View File

@@ -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
@@ -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`.

View File

@@ -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(

View File

@@ -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",
)

View File

@@ -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