-
Notifications
You must be signed in to change notification settings - Fork 242
Closed
Labels
Milestone
Description
As far as I can see there is no way to use environment variables to override the appsettings.json for the downstream API.
The file src/Microsoft.Identity.Web.TokenAcquisition/TokenAcquirerFactory.cs has the following method:
private IConfiguration ReadConfiguration()
{
if (Configuration == null)
{
// Read the configuration from a file
var builder = new ConfigurationBuilder();
string basePath = DefineConfiguration(builder);
builder.SetBasePath(basePath)
.AddJsonFile("appsettings.json", optional: true);
Configuration = builder.Build();
}
return Configuration;
}Changing it to:
private IConfiguration ReadConfiguration()
{
if (Configuration == null)
{
// Read the configuration from a file
var builder = new ConfigurationBuilder();
string basePath = DefineConfiguration(builder);
builder.SetBasePath(basePath)
.AddJsonFile("appsettings.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
return Configuration;
}would provide better flexibility.
Alternatively a way to pass in the configuration to be used would also work.
DaleyKD