26 lines
1.1 KiB
C#
26 lines
1.1 KiB
C#
using NeonSprawl.Server.Game.PositionState;
|
|
|
|
namespace NeonSprawl.Server.Game.Factions;
|
|
|
|
/// <summary>Registers faction standing + reputation delta audit persistence (NEO-135).</summary>
|
|
public static class FactionStandingServiceCollectionExtensions
|
|
{
|
|
/// <summary>PostgreSQL when <c>ConnectionStrings:NeonSprawl</c> is set; otherwise in-memory fallback.</summary>
|
|
public static IServiceCollection AddFactionStandingStores(this IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
var cs = configuration.GetConnectionString(PositionStateServiceCollectionExtensions.NeonSprawlConnectionStringName);
|
|
if (!string.IsNullOrWhiteSpace(cs))
|
|
{
|
|
services.AddSingleton<IFactionStandingStore, PostgresFactionStandingStore>();
|
|
services.AddSingleton<IReputationDeltaStore, PostgresReputationDeltaStore>();
|
|
}
|
|
else
|
|
{
|
|
services.AddSingleton<IFactionStandingStore, InMemoryFactionStandingStore>();
|
|
services.AddSingleton<IReputationDeltaStore, InMemoryReputationDeltaStore>();
|
|
}
|
|
|
|
return services;
|
|
}
|
|
}
|