-
Notifications
You must be signed in to change notification settings - Fork 6
sch-UID2-5444 added feature switch for default min ages in salt rotation #549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sch-UID2-5444 added feature switch for default min ages in salt rotation #549
Conversation
| this.storageManager = storageManager; | ||
| this.saltProvider = saltProvider; | ||
| this.saltRotation = saltRotation; | ||
| this.defaultSaltRotationAgeThresholds = generateThresholds(30, 390, 30); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I think having this calculated may be an overkill, we can just have the array hardcoded here or in generateThresholds. It would be both clearer, easier to change and require less tests.
| final Duration[] minAges = RequestUtil.getDurations(rc, "min_ages_in_seconds"); | ||
| if (minAges == null) return; | ||
|
|
||
| final Duration[] ageThresholds; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's log what thresholds we ended up using
| private final SaltStoreWriter storageManager; | ||
| private final RotatingSaltProvider saltProvider; | ||
| private final SaltRotation saltRotation; | ||
| private final Duration[] defaultSaltRotationAgeThresholds; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can directly just set this variable to be a static final
e.g.
private static final Duration[] SALT_ROTATION_AGE_THRESHOLDS = generateThresholds(30, 390, 30);or
private static final Duration[] SALT_ROTATION_AGE_THRESHOLDS = new Duration[] { ... };There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do the former, remember to make generateThresholds() a static function
Tests: