Spaces:
Running

File size: 3,222 Bytes
e251b13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f0f3f41
 
e251b13
 
 
 
 
 
 
2140ef4
 
e251b13
 
 
 
 
 
 
ee16a3c
 
e251b13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
"""
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