import os
import yaml
from pathlib import Path
from dotenv import load_dotenv

def load_config():
    """
    Loads predeploy.yaml if it exists.
    Returns a dictionary of configuration.
    """
    config_path = Path("predeploy.yaml")
    if config_path.exists():
        try:
            with open(config_path, "r", encoding="utf-8") as f:
                return yaml.safe_load(f) or {}
        except Exception:
            return {}
    return {}

def load_environment():
    """
    Loads .env file if present in the current directory.
    """
    dotenv_path = Path(".env")
    if dotenv_path.exists():
        load_dotenv(dotenv_path)
