[Misc] centralize all usage of environment variables (#4548)

This commit is contained in:
youkaichao
2024-05-02 11:13:25 -07:00
committed by GitHub
parent 1ff0c73a79
commit 5b8a7c1cb0
18 changed files with 220 additions and 64 deletions

View File

@@ -1,7 +1,6 @@
import asyncio
import importlib
import inspect
import os
import re
from contextlib import asynccontextmanager
from http import HTTPStatus
@@ -16,6 +15,7 @@ from prometheus_client import make_asgi_app
from starlette.routing import Mount
import vllm
import vllm.envs as envs
from vllm.engine.arg_utils import AsyncEngineArgs
from vllm.engine.async_llm_engine import AsyncLLMEngine
from vllm.entrypoints.openai.cli_args import make_arg_parser
@@ -129,7 +129,7 @@ if __name__ == "__main__":
allow_headers=args.allowed_headers,
)
if token := os.environ.get("VLLM_API_KEY") or args.api_key:
if token := envs.VLLM_API_KEY or args.api_key:
@app.middleware("http")
async def authentication(request: Request, call_next):