Class RotatingSecretsConfig
java.lang.Object
com.maybeitssquid.rotatingsecrets.spring.RotatingSecretsConfig
Spring configuration that creates and starts the credential provider.
Every UpdatableCredential<String> bean in the context is registered with the
provider, so an application needs no bean names. Any subset of pools works: one, the other, or
both.
Configuration Properties
k8s.secrets.path- Directory with theusernameandpasswordfiles (default:/var/run/secrets/database)k8s.secrets.refresh-interval- Fallback re-check interval. Accepts30s,2m,1h,1d, an ISO-8601 duration such asPT30S, or a bare number of milliseconds (default:30s)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.maybeitssquid.rotatingsecrets.CredentialsProviderServicecredentialsProvider(String secretsPath, String refreshInterval, org.springframework.beans.factory.ObjectProvider<com.maybeitssquid.rotatingsecrets.UpdatableCredential<String>> updatables) Creates the credential provider, registers every updater bean, and starts it.
-
Constructor Details
-
RotatingSecretsConfig
public RotatingSecretsConfig()Default constructor.
-
-
Method Details
-
credentialsProvider
@Bean(initMethod="start", destroyMethod="stop") public com.maybeitssquid.rotatingsecrets.CredentialsProviderService credentialsProvider(@Value("${k8s.secrets.path:/var/run/secrets/database}") String secretsPath, @Value("${k8s.secrets.refresh-interval:30s}") String refreshInterval, org.springframework.beans.factory.ObjectProvider<com.maybeitssquid.rotatingsecrets.UpdatableCredential<String>> updatables) Creates the credential provider, registers every updater bean, and starts it.Updaters are discovered by type. Registration happens before
start(), so the first credential read reaches every updater.- Parameters:
secretsPath- directory with theusernameandpasswordfilesrefreshInterval- fallback re-check interval, parsed byparseRefreshInterval(String)updatables- allUpdatableCredential<String>beans in the context- Returns:
- the started credential provider
-