mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 23:18:56 -07:00
22 lines
691 B
C#
22 lines
691 B
C#
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,
|
|
};
|
|
}
|