import os from typing import Dict from fastapi import APIRouter, HTTPException, status router = APIRouter() @router.get( "/env/content", response_model=Dict[str, str], summary="Get content from CONTENT environment variable", description="Returns the value of the CONTENT environment variable " "if set and not empty" ) def get_content_env_var(): """ Retrieve the value of the CONTENT environment variable. Returns: dict: A dictionary containing the CONTENT environment variable value Raises: HTTPException: If the CONTENT environment variable is not set or is empty """ content_value = os.environ.get("CONTENT") if content_value is None or content_value == "": raise HTTPException( status_code=status.HTTP_404_NOT_FOUND, detail="CONTENT environment variable is not set or is empty" ) return {"content": content_value}