Skip to content

Commit

Permalink
still broken
Browse files Browse the repository at this point in the history
  • Loading branch information
johnml1135 committed Sep 11, 2024
1 parent 93d230a commit ef26abe
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
- ASPNETCORE_Translation__Engines__1__Address=http://machine-engine
- ASPNETCORE_Translation__Engines__2__Type=Nmt
- ASPNETCORE_Translation__Engines__2__Address=http://machine-engine
- "Bugsnag__ApiKey=${Bugsnag__ApiKey:?access key needed}"
expose:
- 80
- 81
Expand Down Expand Up @@ -52,6 +53,7 @@ services:
- ASPNETCORE_Kestrel__Endpoints__Http__Url=http://*:80
- ASPNETCORE_Kestrel__EndpointDefaults__Protocols=Http2
- ASPNETCORE_ConnectionStrings__TranslationPlatformApi=http://serval-api:81
- "Bugsnag__ApiKey=${Bugsnag__ApiKey:?access key needed}"
expose:
- 80
ports:
Expand Down Expand Up @@ -96,6 +98,7 @@ services:
- SharedFile__Uri=s3://silnlp/docker-compose/
- "SharedFile__S3AccessKeyId=${AWS_ACCESS_KEY_ID:?access key needed}"
- "SharedFile__S3SecretAccessKey=${AWS_SECRET_ACCESS_KEY:?secret key needed}"
- "Bugsnag__ApiKey=${Bugsnag__ApiKey:?access key needed}"
expose:
- 80
ports:
Expand Down Expand Up @@ -141,6 +144,7 @@ services:
- SharedFile__Uri=s3://silnlp/docker-compose/
- "SharedFile__S3AccessKeyId=${AWS_ACCESS_KEY_ID:?access key needed}"
- "SharedFile__S3SecretAccessKey=${AWS_SECRET_ACCESS_KEY:?secret key needed}"
- "Bugsnag__ApiKey=${Bugsnag__ApiKey:?access key needed}"
expose:
- 80
ports:
Expand Down
11 changes: 11 additions & 0 deletions src/Serval/src/Serval.Shared/Controllers/BugsnagExceptionFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Microsoft.Extensions.DependencyInjection;

namespace Serval.Shared.Controllers;

public class BugsnagExceptionFilter : ExceptionFilterAttribute
{
public override void OnException(ExceptionContext context)
{
context.HttpContext.RequestServices.GetService<IClient>()?.Notify(context.Exception);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
[TypeFilter(typeof(NotFoundExceptionFilter))]
[TypeFilter(typeof(ForbiddenExceptionFilter))]
[TypeFilter(typeof(BadRequestExceptionFilter))]
public abstract class ServalControllerBase(IAuthorizationService authService) : Controller
public abstract class ServalControllerBase(IAuthorizationService authService, IClient bugsnagClient) : Controller
{
private readonly IAuthorizationService _authService = authService;
protected readonly IClient BugsnagClient = bugsnagClient;

protected string Owner => User.Identity!.Name!;

Expand Down
1 change: 1 addition & 0 deletions src/Serval/src/Serval.Shared/Serval.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

<ItemGroup>
<ProjectReference Include="..\..\..\DataAccess\src\SIL.DataAccess\SIL.DataAccess.csproj" />
<ProjectReference Include="..\..\..\ServiceToolkit\src\SIL.ServiceToolkit\SIL.ServiceToolkit.csproj" />
<ProjectReference Include="..\..\..\..\..\machine\src\SIL.Machine\SIL.Machine.csproj" Condition="Exists('..\..\..\..\..\machine\src\SIL.Machine\SIL.Machine.csproj')" />
<ProjectReference Include="..\Serval.Grpc\Serval.Grpc.csproj" />
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Serval/src/Serval.Shared/Usings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
global using System.Diagnostics;
global using System.Text.Json;
global using System.Text.Json.Serialization;
global using Bugsnag;
global using Grpc.Core;
global using Grpc.Net.ClientFactory;
global using Microsoft.AspNetCore.Authorization;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace SIL.ServiceToolkit.Services;

public class BugSnagOptions
public class BugsnagOptions
{
public const string Key = "BugSnag";
public const string Key = "Bugsnag";

public string ApiKey { get; set; } = "";
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static class IServiceCollectionExtensions
{
public static IServiceCollection AddBugSnag(this IServiceCollection services, IConfiguration? configuration = null)
{
var apiKey = configuration?.GetSection(BugSnagOptions.Key)?.GetValue<string>("ApiKey");
var apiKey = configuration?.GetSection(BugsnagOptions.Key)?.GetValue<string>("ApiKey");
if (apiKey is null)
{
Console.WriteLine("BugSnag ApiKey not available - not adding BugSnag.");
Expand Down

0 comments on commit ef26abe

Please sign in to comment.