mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-26 23:49:02 -07:00
Radicade Public Code
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
namespace RadicadeServer.RecNet.Keepsakes;
|
||||
|
||||
public static class KeepsakeFeature
|
||||
{
|
||||
public static bool? Override { get; set; }
|
||||
|
||||
public static bool Enabled
|
||||
=> Override ?? EnabledFor(KeepsakeRoomConfig.Current, Environment.GetEnvironmentVariable("RADICADE_KEEPSAKES"));
|
||||
|
||||
public static bool EnabledFor(KeepsakeRoomConfig keepsakeRooms, string? environment)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(environment)) return IsOn(environment);
|
||||
return keepsakeRooms.Any;
|
||||
}
|
||||
|
||||
private static bool IsOn(string value) => value.Trim().ToLowerInvariant() switch
|
||||
{
|
||||
"1" or "true" or "on" or "yes" or "enable" or "enabled" => true,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user