nfo

.env Configuration

Load nfo settings from a .env file using python-dotenv — zero hardcoded config in code.

What it shows

Setup

pip install nfo python-dotenv

# Copy template and adjust:
cp examples/.env.example examples/.env

Run

python examples/env-config/main.py

Key code

from dotenv import load_dotenv
load_dotenv()  # loads .env → os.environ

from nfo import configure, log_call
configure()  # reads NFO_LEVEL, NFO_SINKS, NFO_ENV automatically

@log_call
def create_order(order_id: str, amount: float) -> dict:
    return {"order_id": order_id, "status": "created"}

Environment variables

See ../.env.example for all available NFO_* variables:

Variable Description Default
NFO_LEVEL Log level DEBUG
NFO_SINKS Sink specs (comma-separated) console
NFO_ENV Environment tag auto-detect
NFO_VERSION App version auto-detect
NFO_LOG_DIR Log directory ./logs
NFO_LLM_MODEL LLM model for analysis