34 lines
972 B
C#
34 lines
972 B
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace Omika.HfSqlProbe;
|
|
|
|
/// <summary>
|
|
/// Root configuration for local HFSQL test databases.
|
|
/// Never serialize this object — it contains credentials.
|
|
/// </summary>
|
|
public sealed class HfSqlTestConfiguration
|
|
{
|
|
[JsonPropertyName("Server")]
|
|
public string Server { get; set; } = string.Empty;
|
|
|
|
[JsonPropertyName("Port")]
|
|
public int Port { get; set; }
|
|
|
|
[JsonPropertyName("Batik")]
|
|
public HfSqlTestDatabaseConfiguration Batik { get; set; } = new();
|
|
|
|
[JsonPropertyName("Omika")]
|
|
public HfSqlTestDatabaseConfiguration Omika { get; set; } = new();
|
|
|
|
public HfSqlTestDatabaseConfiguration Resolve(string databaseKey)
|
|
{
|
|
return databaseKey.ToLowerInvariant() switch
|
|
{
|
|
"batik" => Batik,
|
|
"omika" => Omika,
|
|
_ => throw new ArgumentException(
|
|
$"Unknown database key '{databaseKey}'. Expected 'batik' or 'omika'.")
|
|
};
|
|
}
|
|
}
|