Skip to content

Commit

Permalink
updated calls
Browse files Browse the repository at this point in the history
  • Loading branch information
witlox committed Dec 9, 2024
1 parent 86de676 commit 84a2751
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ COPY . /code
EXPOSE 8080

ENTRYPOINT [ "gunicorn" ]
CMD ["-b", "0.0.0.0:8080", "horao:init_api", "-k", "uvicorn.workers.UvicornWorker"]
CMD ["-b", "0.0.0.0:8080", "horao:init", "-k", "uvicorn.workers.UvicornWorker"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The command line way:
6. Install the required packages (`poetry install`)
4. Run the project
a. `poetry run python horao/main.py`
b. `poetry run gunicorn horao:init_api -k uvicorn.workers.UvicornWorker --reload`
b. `poetry run gunicorn horao:init -k uvicorn.workers.UvicornWorker --reload`
```

The docker way, either use the `devcontainer` or run with `docker-compose`:
Expand Down
13 changes: 13 additions & 0 deletions horao/api/authenticate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-#
import os

from authlib.integrations.starlette_client import OAuth # type: ignore
Expand All @@ -6,6 +7,13 @@


async def login(request: Request):
"""
responses:
401:
description: Not authorized
302:
description: Redirect after successful login
"""
redirect_uri = request.url_for("auth")
oauth_role_uri = os.getenv("OAUTH_ROLE_URI", "role")
oauth_settings = {
Expand All @@ -31,5 +39,10 @@ async def login(request: Request):


async def logout(request: Request):
"""
responses:
302:
description: Redirect after successful logout
"""
request.session.pop("user", None)
return RedirectResponse(url="/")

0 comments on commit 84a2751

Please sign in to comment.