Download environments.py from dxdoan/WC: direct link, hf CLI and curl.
- Browser
- Download file 3.22 kB
-
https://huggingface.co/spaces/dxdoan/WC/resolve/main/environments.py
- Command line
-
hf download hf://spaces/dxdoan/WC/environments.py
-
curl -L -o environments.py https://huggingface.co/spaces/dxdoan/WC/resolve/main/environments.py
3.22 kB
| """ | |
| Environment configuration for World Cup AI Assistant | |
| Supports local, dev, staging, and production environments | |
| """ | |
| import os | |
| from typing import Dict, Any | |
| # Environment configuration mapping | |
| ENV_CONFIGS = { | |
| "local": { | |
| "name": "Local Development", | |
| "description": "Local development environment", | |
| "agent_url": "http://localhost:8001", | |
| "mcp_server_url": "http://localhost:8000", | |
| "requires_api_key": False, | |
| "color": "#6c757d", # Gray | |
| "icon": "๐ " | |
| }, | |
| "dev": { | |
| "name": "Development", | |
| "description": "Development environment (AWS dev)", | |
| "agent_url": "http://worldcup-mcp-qa-dev-alb-870292921.us-west-2.elb.amazonaws.com", # Update with actual dev IPs | |
| "mcp_server_url": "http://worldcup-mcp-qa-dev-alb-870292921.us-west-2.elb.amazonaws.com", | |
| "requires_api_key": True, | |
| "color": "#28a745", # Green | |
| "icon": "๐ ๏ธ" | |
| }, | |
| "staging": { | |
| "name": "Staging", | |
| "description": "Staging environment (AWS staging)", | |
| "agent_url": "http://worldcup-mcp-qa-staging-alb-966856438.us-west-2.elb.amazonaws.com", # Will be updated | |
| "mcp_server_url": "http://worldcup-mcp-qa-staging-alb-966856438.us-west-2.elb.amazonaws.com", # Will be updated | |
| "requires_api_key": True, | |
| "color": "#ffc107", # Yellow | |
| "icon": "๐งช" | |
| }, | |
| "prod": { | |
| "name": "Production", | |
| "description": "Production environment (AWS prod)", | |
| "agent_url": "https://api.world-cup.ai", | |
| "mcp_server_url": "https://api.world-cup.ai", | |
| "requires_api_key": True, | |
| "color": "#dc3545", # Red | |
| "icon": "๐" | |
| } | |
| } | |
| def get_environment() -> str: | |
| """Get current environment from ENVIRONMENT variable""" | |
| return os.getenv("ENVIRONMENT", "dev").lower() | |
| def get_config(env: str = None) -> Dict[str, Any]: | |
| """Get configuration for specified environment""" | |
| if env is None: | |
| env = get_environment() | |
| return ENV_CONFIGS.get(env, ENV_CONFIGS["dev"]) | |
| def get_current_config() -> Dict[str, Any]: | |
| """Get configuration for current environment""" | |
| return get_config(get_environment()) | |
| def get_agent_url(env: str = None) -> str: | |
| """Get agent URL for specified environment""" | |
| config = get_config(env) | |
| return config["agent_url"] | |
| def get_mcp_server_url(env: str = None) -> str: | |
| """Get MCP server URL for specified environment""" | |
| config = get_config(env) | |
| return config["mcp_server_url"] | |
| def requires_api_key(env: str = None) -> bool: | |
| """Check if environment requires API key""" | |
| config = get_config(env) | |
| return config["requires_api_key"] | |
| def get_environment_display_info(env: str = None) -> Dict[str, str]: | |
| """Get display information for environment badge""" | |
| config = get_config(env) | |
| return { | |
| "name": config["name"], | |
| "description": config["description"], | |
| "color": config["color"], | |
| "icon": config["icon"] | |
| } | |
| def list_environments() -> list: | |
| """List all available environments""" | |
| return list(ENV_CONFIGS.keys()) | |
| def is_valid_environment(env: str) -> bool: | |
| """Check if environment is valid""" | |
| return env in ENV_CONFIGS | |