Skip to content

Commit

Permalink
Fix how security settings are read (#5317)
Browse files Browse the repository at this point in the history
* Fix how security settings are read settings

* small change, big difference
  • Loading branch information
robertpi committed Mar 21, 2024
1 parent 80ac94b commit 654116a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tracer/src/Datadog.Trace/AppSec/SecuritySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ bool GetEnabledDefaultValue()

ApiSecuritySampling = config
.WithKeys(ConfigurationKeys.AppSec.ApiSecurityRequestSampleRate)
.AsDouble(val => val is <= 1 and >= 0)
.GetValueOrDefault(0.1);
.AsDouble(defaultValue: 0.1, validator: val => val is <= 1 and >= 0)
.Value;

ApiSecurityMaxConcurrentRequests = config
.WithKeys(ConfigurationKeys.AppSec.ApiSecurityMaxConcurrentRequests)
.AsInt32(val => val >= 1)
.GetValueOrDefault(1);
.AsInt32(defaultValue: 1, validator: val => val >= 1)
.Value;

ApiSecurityEnabled = config.WithKeys(ConfigurationKeys.AppSec.ApiExperimentalSecurityEnabled)
.AsBool(false);
Expand All @@ -109,13 +109,13 @@ bool GetEnabledDefaultValue()

MaxStackTraces = config
.WithKeys(ConfigurationKeys.AppSec.MaxStackTraces)
.AsInt32(val => val >= 0)
.GetValueOrDefault(2);
.AsInt32(defaultValue: 2, validator: val => val >= 0)
.Value;

MaxStackTraceDepth = config
.WithKeys(ConfigurationKeys.AppSec.MaxStackTraceDepth)
.AsInt32(val => val >= 0)
.GetValueOrDefault(32);
.AsInt32(defaultValue: 32, validator: val => val >= 0)
.Value;
}

public double ApiSecuritySampling { get; }
Expand Down

0 comments on commit 654116a

Please sign in to comment.