mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix _setup_prisma_client
This commit is contained in:
parent
6f3be086b5
commit
e46c789bb7
2 changed files with 11 additions and 11 deletions
|
@ -18,9 +18,10 @@ class PrismaDBExceptionHandler:
|
|||
"""
|
||||
Returns True if the request should be allowed to proceed despite the DB connection error
|
||||
"""
|
||||
from litellm.proxy.proxy_server import general_settings
|
||||
from litellm.proxy.proxy_server import proxy_config
|
||||
|
||||
_allow_requests_on_db_unavailable: Union[bool, str] = general_settings.get(
|
||||
_general_settings = proxy_config.config
|
||||
_allow_requests_on_db_unavailable: Union[bool, str] = _general_settings.get(
|
||||
"allow_requests_on_db_unavailable", False
|
||||
)
|
||||
if isinstance(_allow_requests_on_db_unavailable, bool):
|
||||
|
|
|
@ -457,6 +457,14 @@ async def proxy_startup_event(app: FastAPI):
|
|||
### LOAD MASTER KEY ###
|
||||
# check if master key set in environment - load from there
|
||||
master_key = get_secret("LITELLM_MASTER_KEY", None) # type: ignore
|
||||
# check if DATABASE_URL in environment - load from there
|
||||
if prisma_client is None:
|
||||
_db_url: Optional[str] = get_secret("DATABASE_URL", None) # type: ignore
|
||||
prisma_client = await ProxyStartupEvent._setup_prisma_client(
|
||||
database_url=_db_url,
|
||||
proxy_logging_obj=proxy_logging_obj,
|
||||
user_api_key_cache=user_api_key_cache,
|
||||
)
|
||||
## CHECK PREMIUM USER
|
||||
verbose_proxy_logger.debug(
|
||||
"litellm.proxy.proxy_server.py::startup() - CHECKING PREMIUM USER - {}".format(
|
||||
|
@ -519,15 +527,6 @@ async def proxy_startup_event(app: FastAPI):
|
|||
redis_usage_cache=redis_usage_cache,
|
||||
)
|
||||
|
||||
# check if DATABASE_URL in environment - load from there
|
||||
if prisma_client is None:
|
||||
_db_url: Optional[str] = get_secret("DATABASE_URL", None) # type: ignore
|
||||
prisma_client = await ProxyStartupEvent._setup_prisma_client(
|
||||
database_url=_db_url,
|
||||
proxy_logging_obj=proxy_logging_obj,
|
||||
user_api_key_cache=user_api_key_cache,
|
||||
)
|
||||
|
||||
## JWT AUTH ##
|
||||
ProxyStartupEvent._initialize_jwt_auth(
|
||||
general_settings=general_settings,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue