Skip to content

Commit

Permalink
add host
Browse files Browse the repository at this point in the history
  • Loading branch information
meofiscoding committed Nov 16, 2023
1 parent 6a2f97c commit d3f4521
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions Identity.API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
// Configure DbContext
builder.Services.AddDbContext<AppDbContext>(options =>
options.UseNpgsql(configuration.GetConnectionString("IdentityDB") ?? configuration.GetConnectionString("AZURE_POSTGRESQL_CONNECTIONSTRING")));
builder.Services.AddDbContext<PersistedGrantDbContext>(options =>
options.UseNpgsql(configuration.GetConnectionString("IdentityDB") ?? configuration.GetConnectionString("AZURE_POSTGRESQL_CONNECTIONSTRING")));

builder.Services.AddDbContext<ConfigurationDbContext>(options =>
options.UseNpgsql(configuration.GetConnectionString("IdentityDB") ?? configuration.GetConnectionString("AZURE_POSTGRESQL_CONNECTIONSTRING")));


builder.Services.AddDataProtection()
.PersistKeysToDbContext<AppDbContext>();
Expand Down Expand Up @@ -97,12 +91,12 @@
//.AddInMemoryApiScopes(Config.ApiScopes)
.AddOperationalStore(options =>
{
options.ConfigureDbContext = builder => builder.UseNpgsql(configuration.GetConnectionString("IdentityDB") ?? configuration.GetConnectionString("AZURE_POSTGRESQL_CONNECTIONSTRING"),
options.ConfigureDbContext = builder => builder.UseNpgsql("Host=netflix-identity-server.postgres.database.azure.com;Database=netflix-identity-database;Port=5432;Ssl Mode=Require;User Id=vtqbcezpnv;Password=842M5168LWK5ZMK5$;",
sql => sql.MigrationsAssembly(migrationsAssembly));
})
.AddConfigurationStore(options =>
{
options.ConfigureDbContext = builder => builder.UseNpgsql(configuration.GetConnectionString("IdentityDB") ?? configuration.GetConnectionString("AZURE_POSTGRESQL_CONNECTIONSTRING"),
options.ConfigureDbContext = builder => builder.UseNpgsql("Host=netflix-identity-server.postgres.database.azure.com;Database=netflix-identity-database;Port=5432;Ssl Mode=Require;User Id=vtqbcezpnv;Password=842M5168LWK5ZMK5$;",
sql => sql.MigrationsAssembly(migrationsAssembly));
})
.AddAspNetIdentity<ApplicationUser>()
Expand Down Expand Up @@ -176,10 +170,6 @@ 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 d3f4521

Please sign in to comment.