Move history settings from profile to layered profile

This commit is contained in:
Daniel 2023-08-09 14:45:08 +02:00
parent 3dbde10be0
commit a722b27c01
2 changed files with 7 additions and 25 deletions

View file

@ -49,7 +49,8 @@ type LayeredProfile struct {
DomainHeuristics config.BoolOption `json:"-"` DomainHeuristics config.BoolOption `json:"-"`
UseSPN config.BoolOption `json:"-"` UseSPN config.BoolOption `json:"-"`
SPNRoutingAlgorithm config.StringOption `json:"-"` SPNRoutingAlgorithm config.StringOption `json:"-"`
HistoryEnabled config.BoolOption `json:"-"` EnableHistory config.BoolOption `json:"-"`
KeepHistory config.IntOption `json:"-"`
} }
// NewLayeredProfile returns a new layered profile based on the given local profile. // NewLayeredProfile returns a new layered profile based on the given local profile.
@ -121,10 +122,14 @@ func NewLayeredProfile(localProfile *Profile) *LayeredProfile {
CfgOptionRoutingAlgorithmKey, CfgOptionRoutingAlgorithmKey,
cfgOptionRoutingAlgorithm, cfgOptionRoutingAlgorithm,
) )
lp.HistoryEnabled = lp.wrapBoolOption( lp.EnableHistory = lp.wrapBoolOption(
CfgOptionEnableHistoryKey, CfgOptionEnableHistoryKey,
cfgOptionEnableHistory, cfgOptionEnableHistory,
) )
lp.KeepHistory = lp.wrapIntOption(
CfgOptionKeepHistoryKey,
cfgOptionKeepHistory,
)
lp.LayerIDs = append(lp.LayerIDs, localProfile.ScopedID()) lp.LayerIDs = append(lp.LayerIDs, localProfile.ScopedID())
lp.layers = append(lp.layers, localProfile) lp.layers = append(lp.layers, localProfile)

View file

@ -136,8 +136,6 @@ type Profile struct { //nolint:maligned // not worth the effort
filterListIDs []string filterListIDs []string
spnUsagePolicy endpoints.Endpoints spnUsagePolicy endpoints.Endpoints
spnExitHubPolicy endpoints.Endpoints spnExitHubPolicy endpoints.Endpoints
enableHistory bool
historyRetention int
// Lifecycle Management // Lifecycle Management
outdated *abool.AtomicBool outdated *abool.AtomicBool
@ -235,18 +233,6 @@ func (profile *Profile) parseConfig() error {
} }
} }
enableHistory, ok := profile.configPerspective.GetAsBool(CfgOptionEnableHistoryKey)
if ok {
profile.enableHistory = enableHistory
}
retention, ok := profile.configPerspective.GetAsInt(CfgOptionHistoryRetentionKey)
if ok {
profile.historyRetention = int(retention)
} else {
profile.historyRetention = int(CfgOptionHistoryRetention())
}
return lastErr return lastErr
} }
@ -329,15 +315,6 @@ func (profile *Profile) IsOutdated() bool {
return profile.outdated.IsSet() return profile.outdated.IsSet()
} }
// HistoryEnabled returns true if connection history is enabled for the profile.
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 // GetEndpoints returns the endpoint list of the profile. This functions
// requires the profile to be read locked. // requires the profile to be read locked.
func (profile *Profile) GetEndpoints() endpoints.Endpoints { func (profile *Profile) GetEndpoints() endpoints.Endpoints {