HostBuilder Agregar variables de entorno

 var builder = new HostBuilder();
        builder
        .ConfigureHostConfiguration(config =>
         {
             config.AddEnvironmentVariables(prefix:"DOTNETCORE_");
         })
         .ConfigureAppConfiguration((context, config) =>
         {
             config.AddJsonFile("appsettings.json", optional: false);
             config.AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true);
         })
Attractive Addax