Spaces:
Sleeping
Sleeping
| 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.geoapify.com/v2/places" # using Geoapify endpoint | |
| # ---------- Hugging Face Secrets ---------- | |
| def get_secret(key: str, default: str = None) -> str: | |
| """ | |
| Get secret from environment variables (Hugging Face Spaces or local .env). | |
| Raises RuntimeError if missing. | |
| """ | |
| val = os.getenv(key, default) | |
| if val is None: | |
| raise RuntimeError(f"Missing required environment variable: {key}") | |
| return val | |
| # API Keys / Credentials | |
| 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(): # Keep name same for existing code | |
| return get_secret("OPENTRIPMAP_API_KEY") | |
| OPENTRIPMAP_API_KEY = get_opentripmap_key() | |