py-scopes/scopes/api/deps.py

20 lines
472 B
Python

# scopes.api.deps
"""Common dependencies and other definitions for Web API"""
from fastapi import Depends
from typing import Annotated
from scopes import config
from scopes.storage import common
type Storage = Annotated[common.Storage, Depends(storage)]
type Auth = Annotated[str, Depends(authenticator)]
def storage():
stf = config.StorageFactory(config.settings)
return stf(config.settings.dbschema)
def authenticator():
return config.Authenticator()