using System.Text.RegularExpressions;

namespace GmRelay.DiscordBot.Infrastructure.Logging;

internal static partial class SecretRedactor
{
    public static string RedactConnectionString(string connectionString)
    {
        return PasswordPattern().Replace(connectionString, "$1***");
    }

    [GeneratedRegex(@"(?i)(Password\s*=\s*)[^;]+")]
    private static partial Regex PasswordPattern();
}
