Fix: NucuCar.Sensors creating a telemetry singleton when telemetry is disabled

This commit is contained in:
Denis-Cosmin Nutiu 2019-11-24 14:16:35 +02:00
parent 8434d4f519
commit d703b53a6b

View file

@ -18,8 +18,11 @@ namespace NucuCar.Sensors.Telemetry
_serviceEnabled = configuration.GetValue<bool>("Telemetry:Enabled");
_interval = configuration.GetValue<int>("Telemetry:Interval");
var azureIotHubConnectionString = configuration.GetValue<string>("Telemetry:AzureIotHubConnectionString");
if (_serviceEnabled)
{
SensorTelemetryPublisher.CreateSingleton(azureIotHubConnectionString, "NucuCar.Sensors", logger);
}
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{