Skip to content

Commit 4d4199c

Browse files
committed
change sentry setup
1 parent 548c9ff commit 4d4199c

File tree

3 files changed

+32
-20
lines changed

3 files changed

+32
-20
lines changed

.idea/.idea.RelistenApi/.idea/AndroidProjectSystem.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.idea.RelistenApi/.idea/inspectionProfiles/Project_Default.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RelistenApi/Program.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,28 @@ public static void Main(string[] args)
2727
BuildWebHost(args, port).Run();
2828
}
2929

30-
public static IHostBuilder CreateHostBuilder(string[] args) =>
31-
Host.CreateDefaultBuilder(args)
32-
.ConfigureWebHostDefaults(webBuilder =>
30+
public static IWebHost BuildWebHost(string[] args, int port)
31+
{
32+
var host = WebHost.CreateDefaultBuilder(args);
33+
34+
var sentryDsn = Environment.GetEnvironmentVariable("SENTRY_DSN");
35+
36+
if (!string.IsNullOrEmpty(sentryDsn))
37+
{
38+
Console.WriteLine($"Configuring Sentry: ${sentryDsn}");
39+
// Add the following line:
40+
host.UseSentry(o =>
3341
{
34-
var sentryDsn = Environment.GetEnvironmentVariable("SENTRY_DSN");
35-
36-
if (!string.IsNullOrEmpty(sentryDsn))
37-
{
38-
// Add the following line:
39-
webBuilder.UseSentry(o =>
40-
{
41-
o.Dsn = sentryDsn;
42-
o.SendDefaultPii = true; // we don't have PII?
43-
o.Debug = true;
44-
});
45-
}
42+
o.Dsn = sentryDsn;
43+
o.SendDefaultPii = true; // we don't have PII?
4644
});
45+
}
4746

48-
public static IWebHost BuildWebHost(string[] args, int port) => WebHost.CreateDefaultBuilder(args)
49-
.UseContentRoot(Directory.GetCurrentDirectory())
50-
.UseUrls($"http://*:{port}/")
51-
.UseStartup<Startup>()
52-
.Build();
47+
return host
48+
.UseContentRoot(Directory.GetCurrentDirectory())
49+
.UseUrls($"http://*:{port}/")
50+
.UseStartup<Startup>()
51+
.Build();
52+
}
5353
}
5454
}

0 commit comments

Comments
 (0)