Class BootstrapConfigurationLoader
java.lang.Object
com.svenruppert.jsentinel.bootstrap.BootstrapConfigurationLoader
Loads
BootstrapConfiguration from system properties and environment
variables.
Sources, in order of precedence
- System property (highest)
- Environment variable
- Caller-provided default (lowest)
Keys
| System property | Environment variable |
|---|---|
security.bootstrap.mode |
SECURITY_BOOTSTRAP_MODE |
security.bootstrap.token.file |
SECURITY_BOOTSTRAP_TOKEN_FILE |
security.bootstrap.token.ttl |
SECURITY_BOOTSTRAP_TOKEN_TTL |
The TTL value is parsed as an ISO-8601 duration (e.g. PT15M,
PT24H). If absent, the configuration default applies.
Invalid mode values fail fast with IllegalArgumentException; the
caller decides whether to log + fall back or to abort startup.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault loader reading fromSystem.getProperty(String)andSystem.getenv(String).Test seam: inject custom sources. -
Method Summary
Modifier and TypeMethodDescriptionload(BootstrapMode defaultMode, Path defaultTokenFile, Duration defaultValidity) Builds aBootstrapConfigurationfrom the configured sources.
-
Field Details
-
MODE_PROPERTY
- See Also:
-
MODE_ENV
- See Also:
-
TOKEN_FILE_PROPERTY
- See Also:
-
TOKEN_FILE_ENV
- See Also:
-
TOKEN_TTL_PROPERTY
- See Also:
-
TOKEN_TTL_ENV
- See Also:
-
-
Constructor Details
-
BootstrapConfigurationLoader
public BootstrapConfigurationLoader()Default loader reading fromSystem.getProperty(String)andSystem.getenv(String). -
BootstrapConfigurationLoader
Test seam: inject custom sources.- Parameters:
sysprop- function returning system-property values (typicallySystem.getProperty(String))env- function returning environment-variable values (typicallySystem.getenv(String))
-
-
Method Details
-
load
public BootstrapConfiguration load(BootstrapMode defaultMode, Path defaultTokenFile, Duration defaultValidity) Builds aBootstrapConfigurationfrom the configured sources.- Parameters:
defaultMode- mode used when neither sysprop nor env supply onedefaultTokenFile- token file used inPERSISTENT_FILEmode when neither sysprop nor env supply onedefaultValidity- validity used when no TTL is configured- Returns:
- resolved configuration
- Throws:
IllegalArgumentException- if a configured value is unparseable
-