I'm trying to use Environment variables in my application so I don't have to bother maintaining config files across different systems. Maybe I just have a misunderstanding about where these variables are coming from.
First, I created a Windows System variable called MediatrExampleDbConnection on my local System -> Advanced properties
Then, I have this code in my Startup.cs :
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
When I try to access it later, it comes back null :
var MediatrConnectionString = Configuration["MediatrExampleDbConnection"];
Isn't this supposed to pull from my local System variables since I have .AddEnvironmentVariables(); in there?
