Skip to content

Commit d6a3434

Browse files
committed
Fix delimiters to underscores to support all platforms
Environment keys modified Old: OXIDE:SOMEKEY=SOMEVALUE New: OXIDE_SOMEKEY=SOMEVALUE Fixed section support to comply with Microsoft.Extensions.Configuration library Ex: OXIDE_SOMESECTION__SOMEKEY=SOMEVALUE Sections are separated by double underscores.
1 parent 782b06d commit d6a3434

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/EnvironmentHelper.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ namespace Oxide
77
/// </summary>
88
public static class EnvironmentHelper
99
{
10+
public const string SECTION_DELIMITER = ":";
11+
12+
public const string OXIDE_PREFIX = "OXIDE_";
13+
1014
/// <summary>
1115
/// Gets a OxideMod environmental variable
1216
/// </summary>
@@ -53,16 +57,16 @@ private static string NormalizeKey(string key)
5357
return null;
5458
}
5559

56-
if (!key.StartsWith("oxide:", StringComparison.InvariantCultureIgnoreCase))
60+
if (!key.StartsWith(OXIDE_PREFIX, StringComparison.InvariantCultureIgnoreCase))
5761
{
58-
key = $"Oxide:{key}";
62+
key = OXIDE_PREFIX + key;
5963
}
6064
else
6165
{
62-
key = "Oxide:" + key.Substring(7);
66+
key = OXIDE_PREFIX + key.Substring(6);
6367
}
6468

65-
return key;
69+
return key.Replace(SECTION_DELIMITER, "__").ToUpperInvariant();
6670
}
6771
}
6872
}

0 commit comments

Comments
 (0)