Fix: NucuCar.Sensors creating a telemetry singleton when telemetry is disabled
This commit is contained in:
parent
8434d4f519
commit
d703b53a6b
1 changed files with 4 additions and 1 deletions
|
@ -18,7 +18,10 @@ namespace NucuCar.Sensors.Telemetry
|
||||||
_serviceEnabled = configuration.GetValue<bool>("Telemetry:Enabled");
|
_serviceEnabled = configuration.GetValue<bool>("Telemetry:Enabled");
|
||||||
_interval = configuration.GetValue<int>("Telemetry:Interval");
|
_interval = configuration.GetValue<int>("Telemetry:Interval");
|
||||||
var azureIotHubConnectionString = configuration.GetValue<string>("Telemetry:AzureIotHubConnectionString");
|
var azureIotHubConnectionString = configuration.GetValue<string>("Telemetry:AzureIotHubConnectionString");
|
||||||
SensorTelemetryPublisher.CreateSingleton(azureIotHubConnectionString, "NucuCar.Sensors", logger);
|
if (_serviceEnabled)
|
||||||
|
{
|
||||||
|
SensorTelemetryPublisher.CreateSingleton(azureIotHubConnectionString, "NucuCar.Sensors", logger);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
|
|
Loading…
Reference in a new issue