Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/createrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ jobs:

- name: Publish API
if: ${{ github.event.release.prerelease == false }}
run: dotnet publish "CallbackHandler/CallbackHandler.csproj" --configuration Release --output publishOutput -r win-x64 --self-contained false
run: dotnet publish "CallbackHandler/CallbackHandler.csproj"
--configuration Release --output publishOutput -r win-x64
--self-contained false
-p:Version=${{ steps.get_version.outputs.VERSION }}
-p:AssemblyVersion${{ steps.get_version.outputs.VERSION }}
-p:FileVersion=${{ steps.get_version.outputs.VERSION }}
-p:InformationalVersion${{ steps.get_version.outputs.VERSION }}

- name: Build Release Package
run: |
Expand Down
1 change: 1 addition & 0 deletions CallbackHandler/CallbackHandler.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="9.0.0" />
<PackageReference Include="MediatR" Version="14.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
<PackageReference Include="Sentry.AspNetCore" Version="6.2.0" />
<PackageReference Include="Shared" Version="2026.3.1" />
<PackageReference Include="Shared.Results.Web" Version="2026.3.1" />
<PackageReference Include="SimpleResults.AspNetCore" Version="4.0.0" />
Expand Down
9 changes: 7 additions & 2 deletions CallbackHandler/Handlers/CallbackHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
using CallbackHandlers.Models;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Sentry;
using Shared.Results;
using Shared.Results.Web;
using SimpleResults;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.HttpResults;
using Shared.Results.Web;

namespace CallbackHandler.Handlers;

Expand All @@ -26,6 +27,10 @@
{
Guid callbackId = Guid.NewGuid();

if (depositCallback.Reference == "ExceptionTest") {
throw new Exception("This is a test exception");

Check warning on line 31 in CallbackHandler/Handlers/CallbackHandlers.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

CallbackHandler/Handlers/CallbackHandlers.cs#L31

'System.Exception' should not be thrown by user code.
}

CallbackCommands.RecordCallbackCommand request = new(
callbackId,
JsonConvert.SerializeObject(depositCallback),
Expand Down
34 changes: 31 additions & 3 deletions CallbackHandler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using Shared.General;
using Shared.Logger;
using Shared.Middleware;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NLog.Extensions.Logging;
using Shared.Logger;
using Shared.Middleware;
using JasperFx.CommandLine.Descriptions;

namespace CallbackHandler
{
using Lamar.Microsoft.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using NLog;
using Sentry.Extensibility;
using Shared.DomainDrivenDesign.EventSourcing;
using Shared.EventStore.Aggregate;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Reflection;

[ExcludeFromCodeCoverage]
public class Program
Expand Down Expand Up @@ -68,7 +73,30 @@
webBuilder.UseStartup<Startup>();
webBuilder.UseConfiguration(config);
webBuilder.UseKestrel();

IConfigurationSection isSentryConfigured = config.GetSection("SentryConfiguration");
if (isSentryConfigured.Exists()) {
webBuilder.Configure((context,
app) => {
if (context.HostingEnvironment.IsDevelopment() == false) {
Version version = Assembly.GetExecutingAssembly().GetName().Version;

webBuilder.UseSentry(o => {

o.Dsn = ConfigurationReader.GetValueFromSection<String>("SentryConfiguration", "Dsn");
o.SendDefaultPii = true; // required for body + user data
o.MaxRequestBodySize = RequestSize.Always;
o.CaptureBlockingCalls = true;
//o.CaptureFailedRequests = true;

Check notice on line 90 in CallbackHandler/Program.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

CallbackHandler/Program.cs#L90

Remove this commented out code.
o.Release = version != null ? version.ToString() : "unknown";

});
}
});

}
});

return hostBuilder;
}

Expand Down
5 changes: 3 additions & 2 deletions CallbackHandler/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using CallbackHandler.Endpoints;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using CallbackHandler.Endpoints;

namespace CallbackHandler
{
Expand All @@ -11,6 +11,7 @@ namespace CallbackHandler
using Lamar;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using Sentry;
using Shared.EventStore.Aggregate;
using Shared.Extensions;
using Shared.General;
Expand Down Expand Up @@ -80,7 +81,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerF

Logger.Initialise(logger);
Startup.Configuration.LogConfiguration(Logger.LogWarning);

ConfigurationReader.Initialise(Startup.Configuration);
app.UseMiddleware<TenantMiddleware>();
app.AddRequestResponseLogging();
Expand Down
2 changes: 1 addition & 1 deletion CallbackHandler/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{

}
Loading