23 lines
848 B
C#
23 lines
848 B
C#
using NeonSprawl.Server.Game.PositionState;
|
|
|
|
namespace NeonSprawl.Server.Game.Quests;
|
|
|
|
/// <summary>Registers quest progress persistence: PostgreSQL when configured, otherwise in-memory fallback (NEO-116).</summary>
|
|
public static class QuestStateServiceCollectionExtensions
|
|
{
|
|
public static IServiceCollection AddPlayerQuestStateStore(this IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
var cs = configuration.GetConnectionString(PositionStateServiceCollectionExtensions.NeonSprawlConnectionStringName);
|
|
if (!string.IsNullOrWhiteSpace(cs))
|
|
{
|
|
services.AddSingleton<IPlayerQuestStateStore, PostgresPlayerQuestStateStore>();
|
|
}
|
|
else
|
|
{
|
|
services.AddSingleton<IPlayerQuestStateStore, InMemoryPlayerQuestStateStore>();
|
|
}
|
|
|
|
return services;
|
|
}
|
|
}
|