-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56e0b1a
commit 9572d55
Showing
9 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
"cSpell.words": [ | ||
"ASPNETCORE", | ||
"Bson", | ||
"Bugsnag", | ||
"hmac", | ||
"HMACSHA", | ||
"inferencing", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,8 @@ | |
}); | ||
} | ||
|
||
builder.Services.AddBugSnag(builder.Configuration); | ||
|
||
var app = builder.Build(); | ||
|
||
app.Run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/BugsnagOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace SIL.ServiceToolkit.Services; | ||
|
||
public class BugSnagOptions | ||
{ | ||
public const string Key = "BugSnag"; | ||
|
||
public string ApiKey { get; set; } = ""; | ||
} |
25 changes: 25 additions & 0 deletions
25
src/ServiceToolkit/src/SIL.ServiceToolkit/Configuration/IServiceCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Bugsnag.AspNet.Core; | ||
using Microsoft.Extensions.Configuration; | ||
using SIL.ServiceToolkit.Services; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection; | ||
|
||
public static class IServiceCollectionExtensions | ||
{ | ||
public static IServiceCollection AddBugSnag(this IServiceCollection services, IConfiguration? configuration = null) | ||
{ | ||
var apiKey = configuration?.GetSection(BugSnagOptions.Key)?.GetValue<string>("ApiKey"); | ||
if (apiKey is null) | ||
{ | ||
Console.WriteLine("BugSnag ApiKey not available - not adding BugSnag."); | ||
} | ||
else | ||
{ | ||
services.AddBugsnag(configuration => | ||
{ | ||
configuration.ApiKey = apiKey; | ||
}); | ||
} | ||
return services; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters