-
Notifications
You must be signed in to change notification settings - Fork 393
Expand file tree
/
Copy pathProgram.cs
More file actions
85 lines (63 loc) · 3.13 KB
/
Program.cs
File metadata and controls
85 lines (63 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Copyright (c) Duende Software. All rights reserved.
// See LICENSE in the project root for license information.
using Hosts.ServiceDefaults;
using Projects;
var builder = DistributedApplication.CreateBuilder(args);
var idServer = builder.AddProject<Projects.Hosts_IdentityServer>(AppHostServices.IdentityServer);
var api = builder.AddProject<Projects.Hosts_RemoteApi>(AppHostServices.Api);
var isolatedApi = builder.AddProject<Projects.Hosts_RemoteApi_Isolated>(AppHostServices.IsolatedApi);
var bff = builder.AddProject<Projects.Hosts_Bff_InMemory>(AppHostServices.Bff)
.WithExternalHttpEndpoints()
.WithAwaitedReference(idServer)
.WithAwaitedReference(isolatedApi)
.WithAwaitedReference(api)
;
var bffMulti = builder.AddProject<Projects.Hosts_Bff_MultiFrontend>(AppHostServices.BffMultiFrontend)
.WithExternalHttpEndpoints()
.WithUrl("https://app1.localhost:5005", "https://app1.localhost:5005")
.WithUrl("https://localhost:5005/with-path", "https://localhost/with-path")
.WithAwaitedReference(idServer)
.WithAwaitedReference(isolatedApi)
.WithAwaitedReference(api)
;
var bffEf = builder.AddProject<Projects.Hosts_Bff_EF>(AppHostServices.BffEf)
.WithExternalHttpEndpoints()
.WithAwaitedReference(idServer)
.WithAwaitedReference(isolatedApi)
.WithAwaitedReference(api);
var bffBlazorWebAssembly = builder.AddProject<Projects.Hosts_Bff_Blazor_WebAssembly>(AppHostServices.BffBlazorWebassembly)
.WithExternalHttpEndpoints()
.WithAwaitedReference(idServer)
.WithAwaitedReference(isolatedApi)
.WithAwaitedReference(api);
var bffBlazorPerComponent = builder.AddProject<Projects.Hosts_Bff_Blazor_PerComponent>(AppHostServices.BffBlazorPerComponent)
.WithExternalHttpEndpoints()
.WithAwaitedReference(idServer)
.WithAwaitedReference(isolatedApi)
.WithAwaitedReference(api);
var apiDPop = builder.AddProject<Projects.Hosts_RemoteApi_DPoP>(AppHostServices.ApiDpop);
var bffDPop = builder.AddProject<Projects.Hosts_Bff_DPoP>(AppHostServices.BffDpop)
.WithExternalHttpEndpoints()
.WithAwaitedReference(idServer)
.WithAwaitedReference(apiDPop);
builder.AddProject<Projects.UserSessionDb>(AppHostServices.Migrations);
idServer
.WithReference(bff)
.WithReference(bffMulti)
.WithReference(bffEf)
.WithReference(bffBlazorPerComponent)
.WithReference(bffBlazorWebAssembly)
.WithReference(apiDPop)
.WithReference(bffDPop)
;
builder.AddProject<BffLocalApi>(AppHostServices.TemplateBffLocal, launchProfileName: null)
.WithHttpsEndpoint(5300, name: "bff-local");
builder.AddProject<BffRemoteApi>(AppHostServices.TemplateBffRemote, launchProfileName: null)
.WithHttpsEndpoint(5310, name: "bff-remote");
builder.AddProject<BffBlazorAutoRenderMode>(AppHostServices.TemplateBffBlazor);
builder.Build().Run();
public static class Extensions
{
public static IResourceBuilder<TDestination> WithAwaitedReference<TDestination>(this IResourceBuilder<TDestination> builder, IResourceBuilder<IResourceWithServiceDiscovery> source)
where TDestination : IResourceWithEnvironment, IResourceWithWaitSupport => builder.WithReference(source).WaitFor(source);
}