Add authentication and improve server side configuration

This commit is contained in:
Stone_Red
2025-12-23 14:53:44 +01:00
parent 5819432c36
commit 55f26b3a92
14 changed files with 292 additions and 34 deletions
@@ -0,0 +1,8 @@
namespace RemoteExec.Server.Configuration;
public class ApiKeyConfiguration
{
public required string Key { get; set; }
public string? Description { get; set; }
public bool Enabled { get; set; } = true;
}
@@ -0,0 +1,6 @@
namespace RemoteExec.Server.Configuration;
public class AuthenticationConfiguration
{
public List<ApiKeyConfiguration> ApiKeys { get; set; } = [];
}
@@ -0,0 +1,14 @@
namespace RemoteExec.Server.Configuration;
public class ExecutionConfiguration
{
/// <summary>
/// Maximum number of concurrent tasks. Default is ProcessorCount * 2.
/// </summary>
public int? MaxConcurrentTasks { get; set; }
/// <summary>
/// Timeout for assembly loading requests in seconds. Default is 30 seconds.
/// </summary>
public int AssemblyLoadTimeoutSeconds { get; set; } = 30;
}
@@ -0,0 +1,19 @@
namespace RemoteExec.Server.Configuration;
public class MetricsConfiguration
{
/// <summary>
/// Minimum CPU usage difference (in percentage points) to trigger a metrics broadcast. Default is 1.0.
/// </summary>
public double CpuDifferenceThreshold { get; set; } = 1.0;
/// <summary>
/// Minimum memory usage difference (in bytes) to trigger a metrics broadcast. Default is 10 MB.
/// </summary>
public long MemoryDifferenceThreshold { get; set; } = 10 * 1024 * 1024;
/// <summary>
/// Broadcast interval in milliseconds. Default is 500 ms.
/// </summary>
public int BroadcastIntervalMs { get; set; } = 500;
}