MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / from_env

Method from_env

lightx2v/server/config.py:26–49  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

24
25 @classmethod
26 def from_env(cls) -> "ServerConfig":
27 config = cls()
28
29 if env_host := os.environ.get("LIGHTX2V_HOST"):
30 config.host = env_host
31
32 if env_port := os.environ.get("LIGHTX2V_PORT"):
33 try:
34 config.port = int(env_port)
35 except ValueError:
36 logger.warning(f"Invalid port in environment: {env_port}")
37
38 if env_queue_size := os.environ.get("LIGHTX2V_MAX_QUEUE_SIZE"):
39 try:
40 config.max_queue_size = int(env_queue_size)
41 except ValueError:
42 logger.warning(f"Invalid max queue size: {env_queue_size}")
43
44 # MASTER_ADDR is now managed by torchrun, no need to set manually
45
46 if env_cache_dir := os.environ.get("LIGHTX2V_CACHE_DIR"):
47 config.cache_dir = env_cache_dir
48
49 return config
50
51 def validate(self) -> bool:
52 valid = True

Callers 1

config.pyFile · 0.80

Calls 2

warningMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected