Added proper server config model, added proper apikey authorization with swagger integration, added allowlist and denylist to config
This commit is contained in:
36
src/Server/Models/ConfigModels.cs
Normal file
36
src/Server/Models/ConfigModels.cs
Normal 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; } = [];
|
||||
}
|
||||
Reference in New Issue
Block a user