|
8 | 8 | using System.Threading; |
9 | 9 | using System.Threading.Tasks; |
10 | 10 | using Configuration; |
| 11 | +using Microsoft.Extensions.Options; |
11 | 12 | using Monitoring.HeartbeatMonitoring; |
12 | 13 | using Particular.ServiceControl.Licensing; |
13 | 14 | using ServiceBus.Management.Infrastructure.Settings; |
14 | 15 | using ServiceControl.Api; |
15 | 16 | using ServiceControl.Api.Contracts; |
| 17 | +using ServiceControl.Infrastructure.Settings; |
16 | 18 |
|
17 | | -class ConfigurationApi(ActiveLicense license, |
| 19 | +class ConfigurationApi( |
| 20 | + ActiveLicense license, |
18 | 21 | Settings settings, |
19 | | - IHttpClientFactory httpClientFactory, MassTransitConnectorHeartbeatStatus connectorHeartbeatStatus) : IConfigurationApi |
| 22 | + IOptions<ServiceControlOptions> scOptions, |
| 23 | + IHttpClientFactory httpClientFactory, |
| 24 | + MassTransitConnectorHeartbeatStatus connectorHeartbeatStatus) : IConfigurationApi |
20 | 25 | { |
| 26 | + readonly ServiceControlOptions scOptions = scOptions.Value; |
| 27 | + |
21 | 28 | public Task<RootUrls> GetUrls(string baseUrl, CancellationToken cancellationToken) |
22 | 29 | { |
23 | 30 | var model = new RootUrls |
@@ -56,33 +63,33 @@ public Task<object> GetConfig(CancellationToken cancellationToken) |
56 | 63 | { |
57 | 64 | Host = new |
58 | 65 | { |
59 | | - settings.InstanceName, |
| 66 | + scOptions.InstanceName, |
60 | 67 | Logging = new |
61 | 68 | { |
62 | | - settings.LoggingSettings.LogPath, |
63 | | - LoggingLevel = settings.LoggingSettings.LogLevel |
| 69 | + scOptions.LogPath, |
| 70 | + LoggingLevel = scOptions.LogLevel |
64 | 71 | } |
65 | 72 | }, |
66 | 73 | DataRetention = new |
67 | 74 | { |
68 | | - settings.AuditRetentionPeriod, |
69 | | - settings.ErrorRetentionPeriod |
| 75 | + scOptions.AuditRetentionPeriod, |
| 76 | + scOptions.ErrorRetentionPeriod |
70 | 77 | }, |
71 | 78 | PerformanceTunning = new |
72 | 79 | { |
73 | | - settings.ExternalIntegrationsDispatchingBatchSize |
| 80 | + scOptions.ExternalIntegrationsDispatchingBatchSize |
74 | 81 | }, |
75 | 82 | PersistenceSettings = settings.PersisterSpecificSettings, |
76 | 83 | Transport = new |
77 | 84 | { |
78 | | - settings.TransportType, |
79 | | - settings.ErrorLogQueue, |
80 | | - settings.ErrorQueue, |
81 | | - settings.ForwardErrorMessages |
| 85 | + scOptions.TransportType, |
| 86 | + scOptions.ErrorLogQueue, |
| 87 | + scOptions.ErrorQueue, |
| 88 | + scOptions.ForwardErrorMessages |
82 | 89 | }, |
83 | 90 | Plugins = new |
84 | 91 | { |
85 | | - settings.HeartbeatGracePeriod |
| 92 | + scOptions.HeartbeatGracePeriod |
86 | 93 | }, |
87 | 94 | MassTransitConnector = connectorHeartbeatStatus.LastHeartbeat |
88 | 95 | }; |
|
0 commit comments