namespace ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.Cluster;
///
/// Single source of truth for the dev-cluster database credential used by the
/// Playwright E2E suite.
///
///
/// The connection string mirrors the Docker cluster's scadabridge_app
/// account from docker/central-node-a/appsettings.Central.json, with the
/// host pointed at the host-exposed port (localhost:1433). The
/// SCADABRIDGE_PLAYWRIGHT_DB environment variable lets CI override the
/// connection without recompiling.
///
///
internal static class PlaywrightDbConnection
{
private const string DefaultConnectionString =
"Server=localhost,1433;Database=ScadaBridgeConfig;User Id=scadabridge_app;Password=ScadaBridge_Dev1#;TrustServerCertificate=true;Encrypt=false;Connect Timeout=5";
private const string EnvVar = "SCADABRIDGE_PLAYWRIGHT_DB";
///
/// Connection string for the running cluster's configuration DB. Resolved
/// from SCADABRIDGE_PLAYWRIGHT_DB when set (non-whitespace), otherwise
/// the local docker dev defaults.
///
public static string ConnectionString
{
get
{
var fromEnv = Environment.GetEnvironmentVariable(EnvVar);
return string.IsNullOrWhiteSpace(fromEnv) ? DefaultConnectionString : fromEnv;
}
}
}