using System; using System.Collections.Generic; namespace Robust.Shared.Configuration { public static class EnvironmentVariables { /// /// The environment variable for configuring CVar overrides. The value /// of the variable should be passed as key-value equalities separated by /// semicolons. /// public const string ConfigVarEnvironmentVariable = "ROBUST_CVARS"; /// /// Get the CVar overrides defined in the relevant environment variable. /// public static IEnumerable<(string, string)> GetEnvironmentCVars() { var eVarString = Environment.GetEnvironmentVariable(ConfigVarEnvironmentVariable); if (eVarString == null) { yield break; } foreach (var cVarPair in eVarString.Split(';', StringSplitOptions.RemoveEmptyEntries)) { var pairParts = cVarPair.Split('=', 2); yield return (pairParts[0], pairParts[1]); } } } }