stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace StellaOps.Cryptography.Plugin.PqSoft;
|
||||
|
||||
public sealed partial class PqSoftCryptoProvider
|
||||
{
|
||||
private bool GateEnabled()
|
||||
{
|
||||
if (!_options.RequireEnvironmentGate)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var value = Environment.GetEnvironmentVariable(EnvGate);
|
||||
return string.Equals(value, "1", StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(value, "true", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private void EnsureAllowed()
|
||||
{
|
||||
if (!GateEnabled())
|
||||
{
|
||||
throw new InvalidOperationException($"Provider '{Name}' is disabled. Set {EnvGate}=1 or disable RequireEnvironmentGate to enable.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user