from typing import Union


def bool_from_env(env_value: Union[bool, str]) -> bool:
    """Convert environment variable to boolean."""
    if isinstance(env_value, str):
        env_value = env_value.lower() in ['true', '1']
    return env_value