Skip to content

Commit

Permalink
Merge pull request #64 from argon-chat/fix/db-fix
Browse files Browse the repository at this point in the history
Simplify DB context configuration
  • Loading branch information
0xF6 authored Nov 23, 2024
2 parents c0b864e + 5d5fc80 commit 54b7559
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/Argon.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,9 @@
builder.AddServiceDefaults();
builder.AddRedisOutputCache("cache");
builder.AddRedisClient("cache");

if (builder.Environment.IsManaged())
builder.AddNpgsqlDbContext<ApplicationDbContext>("DefaultConnection", null,
x => x.AddInterceptors([new TimeStampAndSoftDeleteInterceptor()]));
else
builder.Services.AddDbContext<ApplicationDbContext>(x => x
.EnableDetailedErrors()
.EnableSensitiveDataLogging()
.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection"))
.AddInterceptors([new TimeStampAndSoftDeleteInterceptor()]));
builder.Services.AddDbContext<ApplicationDbContext>(x => x
.EnableDetailedErrors().EnableSensitiveDataLogging().UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection"))
.AddInterceptors(new TimeStampAndSoftDeleteInterceptor()));

builder.Services.AddSingleton<IPasswordHashingService, PasswordHashingService>();
builder.Services.AddHttpContextAccessor();
Expand Down

0 comments on commit 54b7559

Please sign in to comment.