diff --git a/NostrStreamer/NostrStreamer.csproj b/NostrStreamer/NostrStreamer.csproj
index ffbd207..084520a 100644
--- a/NostrStreamer/NostrStreamer.csproj
+++ b/NostrStreamer/NostrStreamer.csproj
@@ -48,5 +48,6 @@
+
diff --git a/NostrStreamer/Program.cs b/NostrStreamer/Program.cs
index 6c04707..589186b 100644
--- a/NostrStreamer/Program.cs
+++ b/NostrStreamer/Program.cs
@@ -10,6 +10,7 @@ using NostrStreamer.Services.Background;
using NostrStreamer.Services.Dvr;
using NostrStreamer.Services.StreamManager;
using NostrStreamer.Services.Thumbnail;
+using Prometheus;
namespace NostrStreamer;
@@ -21,7 +22,7 @@ internal static class Program
var services = builder.Services;
var config = builder.Configuration.GetSection("Config").Get();
-
+
ConfigureDb(services, builder.Configuration);
services.AddCors();
services.AddMemoryCache();
@@ -29,11 +30,11 @@ internal static class Program
services.AddRazorPages();
services.AddControllers().AddNewtonsoftJson();
services.AddSingleton(config);
-
+
// GeoIP
services.AddSingleton(_ => new DatabaseReader(config.GeoIpDatabase));
services.AddTransient();
-
+
// nostr auth
services.AddTransient();
services.AddAuthentication(o =>
@@ -49,14 +50,14 @@ internal static class Program
new ClaimsAuthorizationRequirement(ClaimTypes.Name, null)
}, new[] {NostrAuth.Scheme});
});
-
+
// nostr services
services.AddSingleton();
services.AddSingleton(s => s.GetRequiredService());
services.AddSingleton();
services.AddHostedService();
services.AddTransient();
-
+
// streaming services
services.AddTransient();
services.AddHostedService();
@@ -69,11 +70,11 @@ internal static class Program
services.AddTransient();
services.AddHostedService();
services.AddTransient();
-
+
// lnd services
services.AddSingleton();
services.AddHostedService();
-
+
var app = builder.Build();
using (var scope = app.Services.CreateScope())
@@ -82,14 +83,18 @@ internal static class Program
await db.Database.MigrateAsync();
}
+ app.UseRouting();
app.UseCors(o => o.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin());
+ app.UseHttpMetrics();
app.UseAuthorization();
+
app.MapRazorPages();
app.MapControllers();
+ app.MapMetrics();
await app.RunAsync();
}
-
+
private static void ConfigureDb(IServiceCollection services, IConfiguration configuration)
{
services.AddDbContext(o => o.UseNpgsql(configuration.GetConnectionString("Database")));
@@ -108,4 +113,4 @@ internal static class Program
return dummyHost;
}
-}
\ No newline at end of file
+}