Adding expiry threshold and min renewal as properties.

We now allow configuration of expiry threshold and min renewal durations for lease renewal.

Original pull request: gh-278.
This commit is contained in:
Grenville Wilson
2019-02-12 17:08:26 -05:00
committed by Mark Paluch
parent e1ea9c9eff
commit 70faa4228a
2 changed files with 21 additions and 0 deletions

View File

@@ -95,6 +95,17 @@ public class VaultBootstrapPropertySourceConfiguration implements InitializingBe
SecretLeaseContainer secretLeaseContainer = secretLeaseContainerObjectFactory
.getObject();
if (vaultProperties.getConfig().getLifecycle().getMinRenewal() != null) {
secretLeaseContainer.setMinRenewal(
vaultProperties.getConfig().getLifecycle().getMinRenewal());
}
if (vaultProperties.getConfig().getLifecycle().getExpiryThreshold() != null) {
secretLeaseContainer.setMinRenewal(
vaultProperties.getConfig().getLifecycle().getExpiryThreshold());
}
secretLeaseContainer.start();
return new LeasingVaultPropertySourceLocator(vaultProperties, configuration,

View File

@@ -483,6 +483,16 @@ public class VaultProperties implements EnvironmentAware {
*/
private boolean enabled = true;
/**
* The amount of seconds that is at least required before renewing a lease.
*/
private Duration minRenewal;
/**
* The expiry threshold. {@link Lease} is renewed the given seconds before it expires.
*/
private Duration expiryThreshold;
}
}