File size: 1,532 Bytes
6380b21
1300f75
6380b21
1300f75
 
6380b21
 
774b266
6380b21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5e2b486
 
 
1300f75
5e2b486
1300f75
5e2b486
1300f75
5e2b486
 
 
1300f75
 
 
 
5e2b486
 
6380b21
 
 
 
 
 
 
1300f75
6380b21
 
e46b545
6380b21
 
e46b545
6380b21
 
e46b545
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
import os
from dotenv import load_dotenv

# Load .env if present (local dev convenience)
load_dotenv()

APP_TITLE = "PlanMate"
APP_TAGLINE = "AI Powered smart trip planner"

THEME = {
    "bg": "#fcfcfc",
    "text": "#383838",
    "label": "#153d15",
    "border": "#153d15",
}

CURRENCY = "PKR"
UNITS = "metric"
LANGUAGE = "en"

# API Base URLs
AMADEUS_BASE = "https://test.api.amadeus.com"
OPENWEATHER_BASE = "https://api.openweathermap.org"
OPENTRIPMAP_BASE = "https://api.opentripmap.com/0.1/en"

# ---------- Hugging Face Secrets Configuration ----------
def get_secret(key, default=None):
    """
    Get secret from Hugging Face Spaces environment or fallback to local .env
    """
    # Try to get from environment first (Hugging Face Spaces)
    value = os.getenv(key)
    
    if value is None and default is not None:
        return default
    elif value is None:
        st.error(f"Missing required secret: {key}")
        st.info("Please add this secret in your Hugging Face Space settings.")
        st.stop()
    
    return value

def get_env(key: str) -> str:
    val = os.getenv(key)
    if not val:
        raise RuntimeError(f"Missing required environment variable: {key}")
    return val

def get_gemini_key():
    return get_secret("GEMINI_API_KEY")

def get_amadeus_credentials():
    return get_secret("AMADEUS_CLIENT_ID"), get_secret("AMADEUS_CLIENT_SECRET")

def get_openweather_key():
    return get_secret("OPENWEATHER_API_KEY")

def get_opentripmap_key():
    return get_secret("OPENTRIPMAP_API_KEY")