Skip to content

Commit

Permalink
Update MqttInitExtension.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
timia2109 authored Mar 29, 2024
1 parent 92991d2 commit b8dfcf8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions MqttExport/MqttInitExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public static IHostApplicationBuilder AddMqttWriter(this IHostApplicationBuilder
builder.Services.Configure<MqttSettings>(
builder.Configuration.GetSection("Mqtt"));

builder.Services.AddScoped<EspImageProvider>()
.AddScoped<MqttExporter>();

if (!CreateMqttClient(builder))
{
return builder;
Expand Down Expand Up @@ -43,10 +46,8 @@ private static bool CreateMqttClient(IHostApplicationBuilder builder)
builder.Services
.AddSingleton(client)
.AddSingleton(clientOptions)
.AddSingleton<ExportingMqttClient>()
.AddScoped<EspImageProvider>()
.AddScoped<MqttExporter>();
.AddSingleton<ExportingMqttClient>();

return true;
}
}
}

0 comments on commit b8dfcf8

Please sign in to comment.