-
Notifications
You must be signed in to change notification settings - Fork 196
Configuration
guythetechie edited this page Feb 16, 2023
·
4 revisions
We use the default .NET configuration, plus any specified YAML configuration file. Here's the priority order taken from the .NET documentation:
- YAML file specified in configuration key
CONFIGURATION_YAML_PATH
. - Command-line arguments using the Command-line configuration provider.
- Environment variables using the Environment Variables configuration provider.
- App secrets when the app runs in the Development environment.
-
appsettings.Environment.json
using the JSON configuration provider. For example,appsettings.Production.json
andappsettings.Development.json
. -
appsettings.json
using the JSON configuration provider. - ChainedConfigurationProvider : Adds an existing IConfiguration as a source.
You can use multiple providers simultaneously: for instance, apimServiceName
as an environment variable, API_SPECIFICATION_FORMAT
as a command line argument, and overriding a named value in your configuration YAML. When keys conflict between providers, the highest priority provider wins out.
Here's what a sample configuration would look like across providers:
apimServiceName: myapim
namedValues:
- name: environment
properties:
displayName: environment
value: "https://www.search2.com"
apimServiceName: myapimservice
namedValues__0__name: environment
namedValues__0__properties__displayName: environment
namedValues__0__properties__value: https://www.search2.com
{
"apimServiceName": "myapimservice",
"namedValues": [
{
"name": "environment",
"properties": {
"displayName": "environment",
"value": "https://www.search2.com"
}
}
]
}