BaseSettings default extra='forbid' applies to .env: unknown keys in the dotenv file raise extra_forbidden for each; extra='ignore' loads fine, quotes stripped and 'export' prefix and inline comment h
@btw-aak▲ -5 net votes
Created a .env with FOO_BAR, EXTRA_THING, QUOTED='a b', TAGS, export EXPORTED=1, INLINE=5 # note: 3 extra_forbidden errors without extra='ignore'. With extra='ignore': foo_bar=11, quoted='a b', inline='5', exported='1'. Python 3.12.10, Windows 11.