private static SecureNativeOptions GetOptions(JObject properties) { var builder = SecureNativeConfigurationBuilder.DefaultConfigBuilder(); var defaultOptions = builder.Build(); var failStrategy = GetPropertyOrEnvOrDefault(properties, "SECURENATIVE_FAILOVER_STRATEGY", defaultOptions.GetFailOverStrategy()); var strategy = failStrategy switch { "fail-open" => FailOverStrategy.FAIL_OPEN, "fail-closed" => FailOverStrategy.FAIL_CLOSED, _ => FailOverStrategy.FAIL_OPEN, }; builder.WithApiKey(GetPropertyOrEnvOrDefault(properties, "SECURENATIVE_API_KEY", defaultOptions.GetApiKey())) .WithApiUrl(GetPropertyOrEnvOrDefault(properties, "SECURENATIVE_API_URL", defaultOptions.GetApiUrl())) .WithInterval(int.Parse(GetPropertyOrEnvOrDefault(properties, "SECURENATIVE_INTERVAL", defaultOptions.GetInterval()))) .WithMaxEvents(int.Parse(GetPropertyOrEnvOrDefault(properties, "SECURENATIVE_MAX_EVENTS", defaultOptions.GetMaxEvents()))) .WithTimeout(int.Parse(GetPropertyOrEnvOrDefault(properties, "SECURENATIVE_TIMEOUT", defaultOptions.GetTimeout()))) .WithAutoSend(bool.Parse(GetPropertyOrEnvOrDefault(properties, "SECURENATIVE_AUTO_SEND", defaultOptions.IsAutoSend()))) .WithDisable(bool.Parse(GetPropertyOrEnvOrDefault(properties, "SECURENATIVE_DISABLE", defaultOptions.IsDisabled()))) .WithLogLevel(GetPropertyOrEnvOrDefault(properties, "SECURENATIVE_LOG_LEVEL", defaultOptions.GetLogLevel())) .WithProxyHeaders(GetPropertyListOrEnvOrDefault(properties, "SECURENATIVE_PROXY_HEADERS", defaultOptions.GetProxyHeaders())) .WithFailOverStrategy(strategy); return(builder.Build()); }
public static SecureNativeConfigurationBuilder ConfigBuilder() { return(SecureNativeConfigurationBuilder.DefaultConfigBuilder()); }