CSRF secret key bugfix, updated deps, compose yml: removed start_period key

This commit is contained in:
DarkCat09 2023-03-09 17:11:18 +04:00
parent 8b61a6bf8d
commit 856241e58d
5 changed files with 6 additions and 10 deletions

View file

@ -1,7 +1,5 @@
DEBUG=true
SESSION_KEY=debug
CSRF_KEY=debug
SECRET_KEY=debug
APP_HOST=127.0.0.1
APP_PORT=8000

View file

@ -18,8 +18,7 @@ static_dir = str(
# Main configuration
class Settings(BaseSettings):
debug: bool = False
session_key: str = secrets.token_hex(32)
csrf_key: str = secrets.token_hex(32)
secret_key: str = secrets.token_hex(32)
app_host: str = '127.0.0.1'
app_port: int = 8000

View file

@ -42,9 +42,9 @@ for p in paths:
# Add WTForms CSRF protection middlewares
app.add_middleware(
SessionMiddleware,
secret_key=common.settings.session_key,
secret_key=common.settings.secret_key,
)
app.add_middleware(
CSRFProtectMiddleware,
csrf_secret=common.settings.csrf_key,
csrf_secret=common.settings.secret_key,
)

View file

@ -27,4 +27,3 @@ services:
interval: 1s
timeout: 3s
retries: 20
start_period: 10s

View file

@ -1,6 +1,6 @@
fastapi~=0.92.0
fastapi~=0.93.0
starlette~=0.25.0
pydantic~=1.10.5
pydantic~=1.10.6
uvicorn[standard]~=0.20.0
gunicorn~=20.1.0