Skip to content

Commit 184f1e2

Browse files
authored
Automatically Create Subgraph Config for Aspire. (#7000)
1 parent e469640 commit 184f1e2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/HotChocolate/Fusion/src/Aspire/Composition/FusionGatewayConfigurationHelper.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ private static async Task EnsureSubgraphHasConfigAsync(
9090
continue;
9191
}
9292

93-
var config = new SubgraphConfigurationDto(project.Name);
93+
var config = new SubgraphConfigurationDto(
94+
project.Name,
95+
[new HttpClientConfiguration(new Uri("http://localhost:5000"), "http"),]);
9496
var configJson = PackageHelper.FormatSubgraphConfig(config);
9597
await File.WriteAllTextAsync(configFile, configJson, ct);
9698
}
@@ -125,9 +127,13 @@ private static async Task ComposeGatewayAsync(
125127
Directory.CreateDirectory(gatewayDirectory);
126128
}
127129

130+
if (packageFile.Exists)
131+
{
132+
packageFile.Delete();
133+
}
134+
128135
await using var package = FusionGraphPackage.Open(packageFile.FullName);
129-
var subgraphConfigs =
130-
(await package.GetSubgraphConfigurationsAsync(ct)).ToDictionary(t => t.Name);
136+
var subgraphConfigs = (await package.GetSubgraphConfigurationsAsync(ct)).ToDictionary(t => t.Name);
131137
await ResolveSubgraphPackagesAsync(subgraphDirectories, subgraphConfigs, ct);
132138

133139
using var settingsJson = settingsFile.Exists

0 commit comments

Comments
 (0)