Added proper server config model, added proper apikey authorization with swagger integration, added allowlist and denylist to config

This commit is contained in:
2025-12-30 22:18:26 +01:00
parent b5db4bc1e4
commit bc293bf7ec
7 changed files with 126 additions and 135 deletions

View File

@@ -0,0 +1,36 @@
using System.Configuration;
using ElmahCore;
namespace Server.Models;
public class EmbeddingSearchOptions
{
public required ConnectionStringsSection ConnectionStrings { get; set; }
public ElmahOptions? Elmah { get; set; }
public required long EmbeddingCacheMaxCount { get; set; }
public required AiProvider[] AiProviders { get; set; }
public required SimpleAuthOptions SimpleAuth { get; set; }
public string[]? ApiKeys { get; set; }
public required bool UseHttpsRedirection { get; set; }
}
public class AiProvider
{
public required string Handler { get; set; }
public required string BaseURL { get; set; }
public required string ApiKey { get; set; }
public required string[] Allowlist { get; set; }
public required string[] Denylist { get; set; }
}
public class SimpleAuthOptions
{
public List<SimpleUser> Users { get; set; } = [];
}
public class SimpleUser
{
public string Username { get; set; } = "";
public string Password { get; set; } = "";
public string[] Roles { get; set; } = [];
}