Files
OTSSignsOrchestrator/OTSSignsOrchestrator.Core/Configuration/AppConstants.cs
Matt Batchelder 5a0199a598
Some checks failed
Build and Publish Docker Image / build-and-push (push) Has been cancelled
version .1
2026-02-24 22:32:22 -05:00

43 lines
1.9 KiB
C#

namespace OTSSignsOrchestrator.Core.Configuration;
/// <summary>
/// Shared constants for the application.
/// </summary>
public static class AppConstants
{
public const string AdminRole = "Admin";
public const string ViewerRole = "Viewer";
// ── Global Docker secret names ──────────────────────────────────────────
/// <summary>Docker secret name for the global SMTP password.</summary>
public const string GlobalSmtpSecretName = "global_smtp_password";
/// <summary>Docker secret name for the shared MySQL host address.</summary>
public const string GlobalMysqlHostSecretName = "global_mysql_host";
/// <summary>Docker secret name for the shared MySQL port.</summary>
public const string GlobalMysqlPortSecretName = "global_mysql_port";
// ── Per-instance Docker secret name builders ────────────────────────────
/// <summary>Build a per-instance MySQL password secret name from the 3-letter abbreviation.</summary>
public static string CustomerMysqlPasswordSecretName(string abbrev)
=> $"{abbrev}-cms-db-password";
/// <summary>Build a per-instance MySQL username secret name from the 3-letter abbreviation.</summary>
public static string CustomerMysqlUserSecretName(string abbrev)
=> $"{abbrev}-cms-db-user";
/// <summary>Returns all per-instance MySQL secret names for a given abbreviation.</summary>
public static string[] AllCustomerMysqlSecretNames(string abbrev)
=> new[]
{
CustomerMysqlUserSecretName(abbrev),
};
/// <summary>Sanitize a customer name for use in Docker/secret names.</summary>
public static string SanitizeName(string name)
=> new string(name.Where(c => char.IsLetterOrDigit(c) || c == '-' || c == '_').ToArray()).ToLowerInvariant();
}