mirror of
https://git.collinwebdesigns.de/oscar.krause/fastapi-dls.git
synced 2024-11-23 15:31:00 +03:00
refactorings
This commit is contained in:
parent
4b0219b85a
commit
0dc8f6c582
16
app/main.py
16
app/main.py
@ -54,6 +54,14 @@ CORS_ORIGINS = str(env('CORS_ORIGINS', '')).split(',') if (env('CORS_ORIGINS'))
|
|||||||
jwt_encode_key = jwk.construct(INSTANCE_KEY_RSA.export_key().decode('utf-8'), algorithm=ALGORITHMS.RS256)
|
jwt_encode_key = jwk.construct(INSTANCE_KEY_RSA.export_key().decode('utf-8'), algorithm=ALGORITHMS.RS256)
|
||||||
jwt_decode_key = jwk.construct(INSTANCE_KEY_PUB.export_key().decode('utf-8'), algorithm=ALGORITHMS.RS256)
|
jwt_decode_key = jwk.construct(INSTANCE_KEY_PUB.export_key().decode('utf-8'), algorithm=ALGORITHMS.RS256)
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
LOG_LEVEL = logging.DEBUG if DEBUG else logging.INFO
|
||||||
|
logging.basicConfig(format='[{levelname:^7}] [{module:^15}] {message}', style='{')
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
logger.setLevel(LOG_LEVEL)
|
||||||
|
logging.getLogger('util').setLevel(LOG_LEVEL)
|
||||||
|
logging.getLogger('NV').setLevel(LOG_LEVEL)
|
||||||
|
|
||||||
|
|
||||||
# FastAPI
|
# FastAPI
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
@ -89,14 +97,6 @@ app.add_middleware(
|
|||||||
allow_headers=['*'],
|
allow_headers=['*'],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Logging
|
|
||||||
LOG_LEVEL = logging.DEBUG if DEBUG else logging.INFO
|
|
||||||
logging.basicConfig(format='[{levelname:^7}] [{module:^15}] {message}', style='{')
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
logger.setLevel(LOG_LEVEL)
|
|
||||||
logging.getLogger('util').setLevel(LOG_LEVEL)
|
|
||||||
logging.getLogger('NV').setLevel(LOG_LEVEL)
|
|
||||||
|
|
||||||
|
|
||||||
# Helper
|
# Helper
|
||||||
def __get_token(request: Request) -> dict:
|
def __get_token(request: Request) -> dict:
|
||||||
|
Loading…
Reference in New Issue
Block a user