[Platform] Move env check function to platform interface (#48599)

Signed-off-by: wangxiyuan <wangxiyuan1007@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
wangxiyuan
2026-09-16 10:08:36 +00:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent d6a1677d55
commit 118e17f5ff
3 changed files with 19 additions and 10 deletions
+18
View File
@@ -1334,6 +1334,24 @@ class Platform:
"""
return False
@classmethod
def validate_environ(cls, hard_fail: bool) -> None:
"""
Validate environment variables for the current platform.
"""
from vllm import envs
for env in os.environ:
if env.startswith("VLLM_") and env not in envs.environment_variables:
if hard_fail:
raise ValueError(
f"Unknown vLLM environment variable detected: {env}"
)
else:
logger.warning(
"Unknown vLLM environment variable detected: %s", env
)
class UnspecifiedPlatform(Platform):
_enum = PlatformEnum.UNSPECIFIED