I am a little confused how to handle the local settings in web projects, for our Azure functions this seems very trivial and we are using local.settings.json and then we use the ConfigurationBuilder as below to handle local vs Azure config settings
private static readonly IConfiguration config = new ConfigurationBuilder()
.AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables()
.Build();
private static readonly string cosmosDBEndpointUrl = config["cosmosDBEndpointUrl"];
private static readonly string cosmosDBPrimaryKey = config["cosmosDBPrimaryKey"];
private static readonly string cosmosDBName = config["cosmosDBName"];
private static readonly string cosmosDBCollectionNameRawData = config["cosmosDBCollectionNameRawData"];
This works fine for our functions so that it reads the local settings for local dev and azure settings for whatever env we publish to.
But in my webproject there is no local.settings.json so how do I handle the same scenario there?
I looked at appsettings.json but the formsat seems different.