using Microsoft.Owin;
using Microsoft.Owin.FileSystems;
using Owin;
using Umbraco.Web;

public class Startup : UmbracoDefaultOwinStartup
{
    public override void Configuration(IAppBuilder app)
    {
        app.Map("/.well-known", letsEncrypt =>
        {
            letsEncrypt.Use((context, next) =>
            {
                IFileInfo file;

                var fileSystem = new PhysicalFileSystem(@".\.well-known");

                if (!fileSystem.TryGetFileInfo(context.Request.Path.Value, out file))
                {
                    return next();
                }

                return context.Response.SendFileAsync(file.PhysicalPath);
            });
        });

        base.Configuration(app);
    }
}