more audit work
This commit is contained in:
49
src/OpsMemory/StellaOps.OpsMemory.WebService/Program.cs
Normal file
49
src/OpsMemory/StellaOps.OpsMemory.WebService/Program.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) StellaOps. Licensed under the AGPL-3.0-or-later.
|
||||
|
||||
using Npgsql;
|
||||
using StellaOps.OpsMemory.Playbook;
|
||||
using StellaOps.OpsMemory.Similarity;
|
||||
using StellaOps.OpsMemory.Storage;
|
||||
using StellaOps.OpsMemory.WebService.Endpoints;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add PostgreSQL data source
|
||||
var connectionString = builder.Configuration.GetConnectionString("OpsMemory")
|
||||
?? "Host=localhost;Port=5432;Database=stellaops;Username=stellaops;Password=stellaops";
|
||||
builder.Services.AddSingleton<NpgsqlDataSource>(_ => NpgsqlDataSource.Create(connectionString));
|
||||
|
||||
// Add OpsMemory services
|
||||
builder.Services.AddSingleton<IOpsMemoryStore, PostgresOpsMemoryStore>();
|
||||
builder.Services.AddSingleton<SimilarityVectorGenerator>();
|
||||
builder.Services.AddSingleton<PlaybookSuggestionService>();
|
||||
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen(options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new()
|
||||
{
|
||||
Title = "StellaOps OpsMemory API",
|
||||
Version = "v1",
|
||||
Description = "Decision ledger and playbook suggestions API for security operations learning"
|
||||
});
|
||||
});
|
||||
|
||||
builder.Services.AddHealthChecks();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
// Map endpoints
|
||||
app.MapOpsMemoryEndpoints();
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user