Skip to content

Commit

Permalink
Added range validation for EventRetentionPeriod
Browse files Browse the repository at this point in the history
  • Loading branch information
John Simons committed Nov 3, 2016
1 parent 291bf6c commit 0b377d5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/ServiceControl/Infrastructure/Settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,21 @@ private TimeSpan GetEventRetentionPeriod()
TimeSpan result;
if (TimeSpan.TryParse(valueRead, out result))
{
string message;
if (result < TimeSpan.FromHours(1))
{
message = "EventRetentionPeriod settings is invalid, value should be minimum 1 hour.";
logger.Fatal(message);
throw new Exception(message);
}

if (result > TimeSpan.FromDays(200))
{
message = "EventRetentionPeriod settings is invalid, value should be maximum 200 days.";
logger.Fatal(message);
throw new Exception(message);
}

return result;
}
}
Expand Down

0 comments on commit 0b377d5

Please sign in to comment.