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
5 changes: 3 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
<PackageVersion Include="FluentValidation" Version="12.1.1" />
<PackageVersion Include="FluentValidation.AspNetCore" Version="11.3.1" />
<PackageVersion Include="Fossa.Licensing" Version="1.2.2" />
<PackageVersion Include="Fossa.Messaging" Version="0.1.1" />
<PackageVersion Include="Hellang.Middleware.ProblemDetails" Version="6.5.1" />
<PackageVersion Include="IdGen.DependencyInjection" Version="3.0.7" />
<PackageVersion Include="MediatR" Version="14.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.2" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.2" />
<PackageVersion Include="Microsoft.Identity.Web" Version="4.3.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="3.0.0" />
Expand Down
1 change: 1 addition & 0 deletions src/API.Infrastructure/API.Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ItemGroup>
<PackageReference Include="Autofac" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" />
<PackageReference Include="Fossa.Messaging" />
<PackageReference Include="TIKSN-Framework" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Attributes;
using TIKSN.Data;

namespace Fossa.API.Persistence.Mongo.Entities;
Expand Down
2 changes: 2 additions & 0 deletions src/API.Web/IdGenSetupLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public void LogIdGenSetup()
_logger.LogInformation("IdGen: Wraparound interval : {WraparoundInterval}", _idGenerator.Options.IdStructure.WraparoundInterval(_idGenerator.Options.TimeSource));
_logger.LogInformation("IdGen: Wraparound date : {WraparoundDate}", _idGenerator.Options.IdStructure.WraparoundDate(_idGenerator.Options.TimeSource.Epoch, _idGenerator.Options.TimeSource));
_logger.LogInformation("IdGen: Current Generator ID : {GeneratorId}", _idGenerator.Id);
_logger.LogInformation("IdGen: Next ID : {NextID}", _idGenerator.CreateId());
_logger.LogInformation("IdGen: MaxLong : {MaxLong}", long.MaxValue);
}
}
}
9 changes: 7 additions & 2 deletions src/API.Web/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Fossa.API.Web.Filters;
using Fossa.API.Web.HealthChecks.DependencyInjection;
using Fossa.Licensing;
using Fossa.Messaging;
using Hellang.Middleware.ProblemDetails;
using Hellang.Middleware.ProblemDetails.Mvc;
using Microsoft.AspNetCore.Authentication.JwtBearer;
Expand All @@ -28,14 +29,17 @@
using TIKSN.Deployment;
using TIKSN.Mapping;

const string ApplicationName = "Fossa";
const string ServiceName = "API";
var initialReleaseDate = new DateOnly(1956, 05, 01);
var developmentReleaseDate = new DateOnly(TimeProvider.System.GetUtcNow().Year - 69, 05, 01);

var builder = WebApplication.CreateBuilder(args);

builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());

builder.Services.Configure<PagingQueryOptions>(builder.Configuration.GetSection("Paging"));
builder.Services.AddIdGen(builder.Configuration, initialReleaseDate);
builder.Services.AddIdGen(builder.Configuration, builder.Environment.MatchesDevelopment() ? developmentReleaseDate : initialReleaseDate);
builder.Services.AddSingleton<IdGenSetupLogger>();

builder.Services.AddAuthentication(options => options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme)
Expand Down Expand Up @@ -89,6 +93,7 @@

builder.Services.AddFrameworkCore();
builder.Services.AddLicense();
builder.Services.AddMessaging(builder.Configuration, ApplicationName, Seq1(ServiceName));
builder.Services
.AddHealthChecks()
.AddMongoDb(builder.Configuration.GetConnectionString("MongoDB") ?? string.Empty)
Expand Down Expand Up @@ -139,7 +144,7 @@

builder.Services.AddOpenTelemetry()
.ConfigureResource(rb => rb
.AddService(serviceName: "Fossa-API", serviceNamespace: "Fossa")
.AddService(serviceName: $"{ApplicationName}-{ServiceName}", serviceNamespace: ApplicationName)
.AddAttributes(
[
new KeyValuePair<string, object>("deployment.environment", builder.Environment.EnvironmentName),
Expand Down
3 changes: 3 additions & 0 deletions src/API.Web/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
"RootAddress": "http://localhost:9011/",
"_RootAddress": "https://sandbox.fusionauth.io/",
"ApiKey": "047a124c-2dbc-4b68-84cc-55f9a204f4ea"
},
"Messaging": {
"Topic": "Test"
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using System.Net;
using System.Net.Http.Headers;
using System.Net.Http.Json;
using EasyDoubles;
using Fossa.API.FunctionalTests.Seed;
using Fossa.API.Persistence.Mongo.Entities;
using Fossa.API.Web;
using Fossa.API.Web.ApiModels;
using Microsoft.Extensions.DependencyInjection;
using Shouldly;
using Xunit.Abstractions;

Expand Down
Loading