Add support for history data retention

This commit is contained in:
Patrick Pacher
2023-08-08 14:35:43 +02:00
parent 620a9c0fde
commit 3dbde10be0
6 changed files with 169 additions and 10 deletions

View File

@@ -137,6 +137,7 @@ type Profile struct { //nolint:maligned // not worth the effort
spnUsagePolicy endpoints.Endpoints
spnExitHubPolicy endpoints.Endpoints
enableHistory bool
historyRetention int
// Lifecycle Management
outdated *abool.AtomicBool
@@ -239,6 +240,13 @@ func (profile *Profile) parseConfig() error {
profile.enableHistory = enableHistory
}
retention, ok := profile.configPerspective.GetAsInt(CfgOptionHistoryRetentionKey)
if ok {
profile.historyRetention = int(retention)
} else {
profile.historyRetention = int(CfgOptionHistoryRetention())
}
return lastErr
}
@@ -326,6 +334,10 @@ func (profile *Profile) HistoryEnabled() bool {
return profile.enableHistory
}
func (profile *Profile) HistoryRetention() int {
return profile.historyRetention
}
// GetEndpoints returns the endpoint list of the profile. This functions
// requires the profile to be read locked.
func (profile *Profile) GetEndpoints() endpoints.Endpoints {