AddEnvironmentVariables adds operating-system environment variables as key-value configuration settings in ConfigurationManager. It is useful for supplying production values without storing secrets in source control. section 10.2.3
Important behavior:
- WebApplicationBuilder adds the environment-variable provider by default, so explicit registration may already be unnecessary. section 10.2.3
- Environment variables can override defaults from appsettings.json when values are supplied on a production machine or Docker container. section 10.2.3
- Use double underscores to represent configuration sections where colons are unsupported; the imported IConfiguration key uses colons. section 10.2.3
Representing a nested setting
Set an environment variable named MapSettings__MaxNumberOfPoints. The provider imports it as MapSettings:MaxNumberOfPoints, which is the colon-based key to use when retrieving the value from IConfiguration. section 10.2.3
