-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
30 lines (25 loc) · 906 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.DependencyInjection;
using PuppeteerSharp;
using System.Runtime.InteropServices;
using HtmltoPdf.Functions;
var browserFetcherOptions = new BrowserFetcherOptions();
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
browserFetcherOptions.Path = Path.GetTempPath();
}
var bf = new BrowserFetcher(browserFetcherOptions);
bf.DownloadAsync().GetAwaiter().GetResult();
var browser = bf.GetInstalledBrowsers().First();
var info = new AppInfo(bf.GetExecutablePath(browser.BuildId));
var host = new HostBuilder()
.ConfigureFunctionsWebApplication()
.ConfigureServices(services =>
{
services.AddApplicationInsightsTelemetryWorkerService();
services.ConfigureFunctionsApplicationInsights();
services.AddSingleton<AppInfo>(info);
})
.Build();
host.Run();