Skip to content

Commit

Permalink
Update Program.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
meofiscoding committed Nov 16, 2023
1 parent d71ea73 commit 6a2f97c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Identity.API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@
//.AddInMemoryApiScopes(Config.ApiScopes)
.AddOperationalStore(options =>
{
options.ConfigureDbContext = builder => builder.UseNpgsql("Server=netflix-identity-server.postgres.database.azure.com;Database=netflix-identity-database;Port=5432;Ssl Mode=Require;User Id=vtqbcezpnv;Password=842M5168LWK5ZMK5$;",
options.ConfigureDbContext = builder => builder.UseNpgsql(configuration.GetConnectionString("IdentityDB") ?? configuration.GetConnectionString("AZURE_POSTGRESQL_CONNECTIONSTRING"),
sql => sql.MigrationsAssembly(migrationsAssembly));
})
.AddConfigurationStore(options =>
{
options.ConfigureDbContext = builder => builder.UseNpgsql("Server=netflix-identity-server.postgres.database.azure.com;Database=netflix-identity-database;Port=5432;Ssl Mode=Require;User Id=vtqbcezpnv;Password=842M5168LWK5ZMK5$;",
options.ConfigureDbContext = builder => builder.UseNpgsql(configuration.GetConnectionString("IdentityDB") ?? configuration.GetConnectionString("AZURE_POSTGRESQL_CONNECTIONSTRING"),
sql => sql.MigrationsAssembly(migrationsAssembly));
})
.AddAspNetIdentity<ApplicationUser>()
Expand Down Expand Up @@ -176,6 +176,10 @@ static void InitializeDatabase(IApplicationBuilder app)
throw new System.Exception("Could not create service scope");
}

if (serviceScope.ServiceProvider.GetRequiredService<PersistedGrantDbContext>() == null){
throw new System.Exception("Could not get service of PersistedGrantDbContext");
}

serviceScope.ServiceProvider.GetRequiredService<PersistedGrantDbContext>().Database.Migrate();
try
{
Expand Down

0 comments on commit 6a2f97c

Please sign in to comment.