Files
CaddyManager/CaddyManager/Models/Caddy/CaddyConfigurationInfo.cs
Duy Dao 401f9a8f51
All checks were successful
Caddy Manager CI build / docker (push) Successful in 1m0s
fix: Implement object equality for CaddyConfigurationInfo to enable list selection
2025-07-16 23:13:42 +07:00

44 lines
1.2 KiB
C#

namespace CaddyManager.Models.Caddy;
/// <summary>
/// Wraps the information parsed from the Caddy configuration file.
/// </summary>
public class CaddyConfigurationInfo
{
/// <summary>
/// Hostnames that are configured in the Caddyfile.
/// </summary>
public List<string> Hostnames { get; set; } = [];
/// <summary>
/// The hostname of the reverse proxy server.
/// </summary>
public string ReverseProxyHostname { get; set; } = string.Empty;
/// <summary>
/// Ports being used with the reverse proxy hostname
/// </summary>
public List<int> ReverseProxyPorts { get; set; } = [];
/// <summary>
/// The name of the configuration file.
/// </summary>
public string FileName { get; set; } = string.Empty;
/// <summary>
/// Aggregated ports for the reverse proxy hostname from all configurations.
/// </summary>
public List<int> AggregatedReverseProxyPorts { get; set; } = [];
public override bool Equals(object? obj)
{
if (obj is not CaddyConfigurationInfo other)
return false;
return FileName == other.FileName;
}
public override int GetHashCode()
{
return FileName.GetHashCode();
}
}