no-defaulted-environment-setting
A settings field that names the deployment environment must not declare a default.
Why
A defaulted environment setting lets a deployment that forgot the variable start as the default environment, so it quietly behaves like local or development code and can share state with another stack.
Fix
Declare the field without a default, for example environment: Environment = Field(alias="ENVIRONMENT"), so a missing value fails at startup.
Examples
from pydantic import Fieldfrom pydantic_settings import BaseSettings
class Settings(BaseSettings): environment: str = Field(default="local", alias="ENVIRONMENT")from pydantic import Fieldfrom pydantic_settings import BaseSettings
class Settings(BaseSettings): environment: str = Field(alias="ENVIRONMENT")