Files
richard-churchman 0d0d936523 Added secrets tokenisation with Docker Secrets compatibility:
* Resolve secrets from file topology where file name is key and trimmed
  file contents are value, compatible with Docker Secrets tmpfs mounting.
* Support [@Key@] token pattern inside Environment Variable strings,
  allowing verbose connection strings to live outside declared secrets.
* SecretsPath configurable via environment variable or appSettings,
  falling back to working directory for local development convenience.
* Secrets processing occurs at startup before logging, with diagnostics
  written to STDOUT.
* Tokenisation extracted into standalone library and included in Dockerfile
* Documentation added covering token pattern and Docker Secrets compatibility.
2026-03-22 14:33:49 +01:00

41 lines
1.4 KiB
C#

/* Copyright (C) 2022-present Jube Holdings Limited.
*
* This file is part of Jube™ software.
*
* Jube™ is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* Jube™ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License along with Jube™. If not,
* see <https://www.gnu.org/licenses/>.
*/
namespace Jube.Tokenisation
{
using System.Text.RegularExpressions;
public static class Tokenisation
{
public static List<string> ReturnTokens(string message)
{
var matches = Regex.Matches(message, @"\[@(.*?)\]");
var returnList = new List<string>();
foreach (var match in matches)
{
var key = match.ToString()?.Remove(0, 2);
if (key == null)
{
continue;
}
key = key.Remove(key.Length - 2, 2);
returnList.Add(key);
}
return returnList;
}
}
}