title: How to read environment variables in .NET 6?
body: <p>in my .NET Core 3.1 WebApi project I'm reading environment variable as the very first thing and loading appsettings.json according to it:</p>
  <pre><code>public static IHostBuilder CreateHostBuilder(string[] args)
  {
    string environment = Environment.GetEnvironmentVariable(&quot;ASPNETCORE_ENVIRONMENT&quot;);
    ...
  }
  </code></pre>
  <p>But I didn't find out how to read it in .NET 6:</p>
  <p><code>var builder = WebApplication.CreateBuilder(args);</code></p>
  <p>build.Environment has no way to read it.<br />
  Anyone knows?</p>
  <p>Thanks</p>