[#117] Refactor fetch/parse config parameters functions #189
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-s3-gw#189
Loading…
Reference in a new issue
No description provided.
Delete branch ":feature/117-refactor-fetch-parse-functions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Signed-off-by: Roman Loginov r.loginov@yadro.com
@ -786,14 +718,7 @@ func (a *App) initHandler() {
}
if a.cfg.IsSet(cfgDefaultMaxAge) {
Let's move this check into
fetchDefaultMaxAge
function. If this value isn't set then returnhandler.DefaultMaxAge
from the function@ -159,0 +265,4 @@
return defaultValue
}
func fetchSize(v *viper.Viper, l *zap.Logger, cfgEntry string, defaultValue int) int {
Let's rename this to
fetchCacheSize
.@ -159,0 +249,4 @@
return timeout
}
func fetchLifetime(v *viper.Viper, l *zap.Logger, cfgEntry string, defaultValue time.Duration) time.Duration {
Let's rename this to
fetchCacheLifetime
.@ -424,3 +392,1 @@
var defaultPlacementPolicy netmap.PlacementPolicy
if err := defaultPlacementPolicy.DecodeString(defaultPolicy); err != nil {
return fmt.Errorf("parse default policy '%s': %w", defaultPolicy, err)
func (p *placementPolicy) updatePolicy(v *viper.Viper, regionPolicyFilepath string) error {
Let's get
regionPolicyFilepath
inside this function. Or even create functionfetchRegionMappingPolicies
that would look likesand we can call it here (in
updatePolicy
)06b2241503
to3be0b7b6cf
@ -795,3 +704,1 @@
}
cfg.DefaultMaxAge = defaultMaxAge
}
cfg.DefaultMaxAge = fetchDefaultMaxAge(a.cfg, a.log)
Actually, now we can set this field in
L699
above3be0b7b6cf
tocebd7ec83e
dkirillov referenced this pull request2023-08-21 06:57:59 +00:00
cebd7ec83e
to6a9d3261a7