From 95ed21bdd5a8e8dc0b0a75bdd06c60dbd20fa1c3 Mon Sep 17 00:00:00 2001 From: Jakub Miazek Date: Mon, 24 Jul 2023 12:43:26 +0200 Subject: [PATCH] update env vars for redis and jwt --- .env | 12 ++++++++++-- .secrets | 2 +- README.md | 10 ++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 9c04ee3..01bd42c 100644 --- a/.env +++ b/.env @@ -8,5 +8,13 @@ SQL_USER=user SQL_PASS=secret SQL_URL=postgresql+asyncpg://${SQL_USER}:${SQL_PASS}@${SQL_HOST}/${SQL_DB} -ALGORITHM=HS256 -ACCESS_TOKEN_EXPIRE_MINUTES=30 +REDIS_HOST=redis +REDIS_PORT=6379 +REDIS_DB=2 +REDIS_URL="redis://${REDIS_HOST}:${REDIS_PORT}/${REDIS_DB}" + +JWT_EXPIRE=3600 +JWT_ALGORITHM=HS256 + + + diff --git a/.secrets b/.secrets index 1b04366..e72b6fe 100644 --- a/.secrets +++ b/.secrets @@ -1,2 +1,2 @@ POSTGRES_PASSWORD=secret -SECRET_KEY=key +FERNET_KEY=Ms1HSn513x0_4WWFBQ3hYPDGAHpKH_pIseC5WwqyO7M= \ No newline at end of file diff --git a/README.md b/README.md index 6516e53..7e3efc3 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,16 @@ Below steps were done to integrate [rich](https://github.com/Textualize/rich) in ### User authentication with JWT and Redis as token storage :lock: :key: +#### Generate Fernet key for storing password in db +```python +In [1]: from cryptography.fernet import Fernet + +In [2]: Fernet.generate_key() +Out[2]: b'Ms1HSn513x0_4WWFBQ3hYPDGAHpKH_pIseC5WwqyO7M=' + +``` +Save the key in .secrets as FERNET_KEY + ### Local development with poetry