Browse Source

Remove RemoveUnnecessaryDbMigratorClients

pull/18583/head
liangshiwei 2 years ago
parent
commit
be260f7f07
  1. 33
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs

33
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/RemoveUnnecessaryPortsStep.cs

@ -12,7 +12,6 @@ public class RemoveUnnecessaryPortsStep : ProjectBuildPipelineStep
{
public override void Execute(ProjectBuildContext context)
{
RemoveUnnecessaryDbMigratorClients(context);
RemoveUnnecessaryHttpApiHostPorts(context);
}
@ -66,36 +65,4 @@ public class RemoveUnnecessaryPortsStep : ProjectBuildPipelineStep
httpApiHostAppSettings.SetLines(newlines);
}
private static void RemoveUnnecessaryDbMigratorClients(ProjectBuildContext context)
{
var dbMigratorAppSettings = context.Files
.FirstOrDefault(f =>
f.Name.Contains("MyCompanyName.MyProjectName.DbMigrator") && f.Name.EndsWith("appsettings.json"));
if (dbMigratorAppSettings == null)
{
return;
}
var appSettingsJsonObject = JObject.Parse(dbMigratorAppSettings.Content);
var authServerJsonObject = (JObject)appSettingsJsonObject?["IdentityServer"] ?? (JObject)appSettingsJsonObject["OpenIddict"];
var clientsJsonObject = (JObject)authServerJsonObject?["Clients"] ?? (JObject)authServerJsonObject?["Applications"];
if (clientsJsonObject == null)
{
return;
}
if (context.BuildArgs.UiFramework != UiFramework.Blazor)
{
clientsJsonObject.Remove("MyProjectName_Blazor");
}
if (!context.BuildArgs.PublicWebSite)
{
clientsJsonObject.Remove("MyProjectName_Web_Public");
}
dbMigratorAppSettings.SetContent(appSettingsJsonObject.ToString(Formatting.Indented));
}
}

Loading…
Cancel
Save