|
19 | 19 | using Microsoft.OpenApi.Models; |
20 | 20 | using Scalar.AspNetCore; |
21 | 21 | using Serilog; |
22 | | -using Swashbuckle.AspNetCore.SwaggerGen; |
23 | 22 |
|
24 | 23 | List<ActionStep> _systemStatusItems = []; |
25 | 24 | void AddSystemStatusItem(string systemStatusCategory, string systemStatusKey, string title, string description, bool hasError = false, bool hasWarning = false) => _systemStatusItems.Add(new ActionStep(systemStatusKey, systemStatusCategory, title, description, hasError, hasWarning)); |
26 | 25 |
|
27 | | -var assembly = typeof(Certify.Server.Hub.Api.Startup).Assembly; |
| 26 | +var hubServiceAssembly = typeof(Certify.Server.HubService.Services.CertifyDirectHubService).Assembly; |
28 | 27 |
|
29 | 28 | // set working directory so that when we are started as a service we can find our config |
30 | | -var cwd = Path.GetDirectoryName(assembly.Location); |
| 29 | +var cwd = Path.GetDirectoryName(hubServiceAssembly.Location); |
31 | 30 | if (cwd != null) |
32 | 31 | { |
33 | | - |
34 | 32 | System.Diagnostics.Debug.WriteLine($"Using working directory {cwd}"); |
35 | 33 | Directory.SetCurrentDirectory(cwd); |
36 | 34 | } |
|
94 | 92 | description: "Hub API using directly integrated primary service." |
95 | 93 | ); |
96 | 94 |
|
97 | | -// Add services to the container |
98 | | - |
99 | | -var part = new AssemblyPart(assembly); |
100 | | - |
101 | 95 | builder.Services.AddCors(options => |
102 | 96 | { |
103 | 97 | options.AddDefaultPolicy(builder => |
|
112 | 106 | .AddTokenAuthentication(builder.Configuration) |
113 | 107 | .AddAuthorization() |
114 | 108 | .AddControllers() |
115 | | - .ConfigureApplicationPartManager(apm => apm.ApplicationParts.Add(part)); |
| 109 | + .ConfigureApplicationPartManager((apm) => |
| 110 | + { |
| 111 | + // remove service core assembly part, as controllers from this assembly are not needed in the hub API |
| 112 | + var serviceCore = (apm.ApplicationParts.FirstOrDefault(p => p.Name == "Certify.Server.Core") as AssemblyPart); |
| 113 | + if (serviceCore != null) |
| 114 | + { |
| 115 | + apm.ApplicationParts.Remove(serviceCore); |
| 116 | + } |
| 117 | + }); |
116 | 118 |
|
117 | 119 | builder.Services |
118 | 120 | .AddRouting(r => r.LowercaseUrls = true) |
|
153 | 155 |
|
154 | 156 | c.UseAllOfToExtendReferenceSchemas(); |
155 | 157 |
|
156 | | - c.DocInclusionPredicate((docName, apiDesc) => |
157 | | - { |
158 | | - if (!apiDesc.TryGetMethodInfo(out MethodInfo methodInfo)) |
159 | | - { |
160 | | - return false; |
161 | | - } |
| 158 | + /* c.DocInclusionPredicate((docName, apiDesc) => |
| 159 | + { |
| 160 | + if (!apiDesc.TryGetMethodInfo(out MethodInfo methodInfo)) |
| 161 | + { |
| 162 | + return false; |
| 163 | + } |
162 | 164 |
|
163 | | - return methodInfo.DeclaringType.Namespace.StartsWith("Certify.Server.Hub.Api.Controllers"); |
164 | | - }); |
| 165 | + return methodInfo.DeclaringType.Namespace.StartsWith("Certify.Server.Hub.Api.Controllers"); |
| 166 | + });*/ |
165 | 167 |
|
166 | 168 | // use the actual method names as the generated operation id |
167 | 169 | c.CustomOperationIds(e => |
|
0 commit comments