Closed xperiandri closed 4 years ago
It's really good question ^_^
Also ILogger
created from ILoggerFactory
would be useful
These and other questions at some point pushed me to abandon application {}
and just use raw webhostbuilder.
However now that panesofglass found an overload trick for custom CE operations we could add all the missing overloads.
@NinoFloris could you explain or post an excerpt of code?
To answer the original question - this should work fine:
app_config (fun app ->
let env = app.ApplicationServices.GetService<IWebHostEnvironment >()
if (env.IsDevelopment()) then
app.UseDeveloperExceptionPage()
else
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts()
)
Saturn 0.14 will include some helper to replace app.ApplicationServices.GetService<IWebHostEnvironment >()
call with something more user friendly.
How to convert this code into Saturn compliant?