|
1 | 1 | using System.Reflection; |
| 2 | +using Azure.Identity; |
2 | 3 | using Dfe.SignIn.AppHost; |
3 | 4 | using Microsoft.Extensions.Configuration; |
| 5 | +using Microsoft.Extensions.Configuration.AzureAppConfiguration; |
4 | 6 |
|
5 | 7 | var builder = DistributedApplication.CreateBuilder(args); |
| 8 | + |
| 9 | +if (!string.IsNullOrEmpty(builder.Configuration.GetConnectionString("AppConfiguration"))) { |
| 10 | + var appConfigurationTag = builder.Configuration["AppConfiguration:Tag"]; |
| 11 | + if (string.IsNullOrEmpty(appConfigurationTag)) { |
| 12 | + throw new ArgumentNullException("AppConfiguration Tag missing"); |
| 13 | + } |
| 14 | + builder.Configuration.AddAzureAppConfiguration(options => { |
| 15 | + options.Connect(builder.Configuration["ConnectionStrings:AppConfiguration"]) |
| 16 | + .Select(KeyFilter.Any, "dev"); |
| 17 | + |
| 18 | + options.ConfigureKeyVault(kv => { |
| 19 | + kv.SetCredential(new DefaultAzureCredential()); |
| 20 | + }); |
| 21 | + }); |
| 22 | +} |
| 23 | + |
6 | 24 | builder.Configuration.AddUserSecrets(Assembly.GetExecutingAssembly(), optional: true, reloadOnChange: true); |
7 | 25 |
|
8 | 26 | #pragma warning disable ASPIRECERTIFICATES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed. |
|
41 | 59 | var selectOrgConfig = builder.Configuration.GetSection("SelectOrganisation"); |
42 | 60 | var internalApiConfig = builder.Configuration.GetSection("InternalApiClient"); |
43 | 61 | var efConfig = builder.Configuration.GetSection("EntityFramework"); |
| 62 | +var assets = builder.Configuration.GetSection("Assets"); |
44 | 63 |
|
45 | 64 | var dotNetComponents = builder.Configuration.GetSection("Components:DotNet"); |
46 | 65 | var nodeComponents = builder.Configuration.GetSection("Components:Node"); |
|
52 | 71 | .WithEnvironment("GovNotify__ApiKey", govNotifyConfig["ApiKey"]) |
53 | 72 | .WithEnvironment("RaiseSupportTicketByEmail__SupportEmailAddress", supportEmailConfig["SupportEmailAddress"]) |
54 | 73 | .WithEnvironment("RaiseSupportTicketByEmail__EmailTemplateId", supportEmailConfig["EmailTemplateId"]) |
| 74 | + .WithEnvironment("Assets__BaseAddress", assets["BaseAddress"]) |
| 75 | + .WithEnvironment("Assets__FrontendVersion", assets["FrontendVersion"]) |
55 | 76 | .WaitFor(frontend) |
56 | 77 | .WaitFor(redis); |
57 | 78 | } |
|
66 | 87 | .WithEnvironment("EntityFramework__Organisations__Name", efConfig["Organisations:Name"]) |
67 | 88 | .WithEnvironment("EntityFramework__Organisations__Username", efConfig["Organisations:Username"]) |
68 | 89 | .WithEnvironment("EntityFramework__Organisations__Password", efConfig["Organisations:Password"]) |
| 90 | + .WithEnvironment("PublicApiSecretEncryption__Key", publicApiSecretConfig["Key"]) |
69 | 91 | .WithEnvironment("InternalApiClient__ClientId", internalApiConfig["ClientId"]) |
70 | 92 | .WithEnvironment("InternalApiClient__ClientSecret", internalApiConfig["ClientSecret"]) |
71 | 93 | .WithEnvironment("InternalApiClient__Tenant", internalApiConfig["Tenant"]) |
|
95 | 117 | .WithEnvironment("ExternalId__TenantId", externalIdConfig["TenantId"]) |
96 | 118 | .WithEnvironment("Session__DurationInMinutes", sessionConfig["DurationInMinutes"]) |
97 | 119 | .WithEnvironment("Session__NotifyRemainingMinutes", sessionConfig["NotifyRemainingMinutes"]) |
| 120 | + .WithEnvironment("Assets__BaseAddress", assets["BaseAddress"]) |
| 121 | + .WithEnvironment("Assets__FrontendVersion", assets["FrontendVersion"]) |
98 | 122 | .WaitFor(frontend) |
99 | 123 | .WaitFor(redis); |
100 | 124 | } |
|
154 | 178 | .WaitForIfPresent(interactor); |
155 | 179 | } |
156 | 180 |
|
157 | | -builder.AddExecutable("tool-tls-proxy", "pwsh", "../../", "-Command", "Start-DsiTlsProxy"); |
158 | | - |
| 181 | +if (nodeComponents.GetValue("Run-TlsProxy", false)) { |
| 182 | + builder.AddExecutable("tool-tls-proxy", "pwsh", "../../", "-Command", "Start-DsiTlsProxy"); |
| 183 | +} |
159 | 184 | await builder.Build().RunAsync(); |
0 commit comments