I have arguments passed in via the command-line
private static int Main(string[] args)
{
const string PORT = "12345" ;
var listeningUrl = $"http://localhost:{PORT}";
var builder = new WebHostBuilder()
.UseStartup<Startup>()
.UseKestrel()
.UseUrls(listeningUrl);
var host = builder.Build();
WriteLine($"Running on {PORT}");
host.Run();
return 0;
}
One of these arguments is a logging output directory. How do I get this value into my Startup class so I can write out to this directory when I receive a request?
I'd like to avoid using a static class. Would a service that supplies the value be the right way? If so, how do I get services injected into my middleware?