Class ConfigurationValueResolver
java.lang.Object
com.iantapply.orchestra.configuration.ConfigurationValueResolver
Resolves configured values consistently from system properties, environment, files, and inline values.
-
Constructor Summary
ConstructorsConstructorDescriptionConfigurationValueResolver(Path baseDirectory) Uses the current process environment and system properties.ConfigurationValueResolver(Path baseDirectory, Map<String, String> environment, Function<String, String> systemProperties) Creates a resolver with injectable process sources for platforms and tests. -
Method Summary
Modifier and TypeMethodDescriptionreadSecretFile(String configuredPath) Reads an optional UTF-8 secret file, resolving relative paths against the base directory.require(String label, String systemProperty, String environmentVariable, String secretFile, String configuredValue) Resolves a required value or reports its configuration label.Resolves environment, file, then inline precedence without a system-property override.resolve(String systemProperty, String environmentVariable, String secretFile, String configuredValue) Resolves the first nonblank value using system property, environment, file, then inline precedence.
-
Constructor Details
-
ConfigurationValueResolver
Uses the current process environment and system properties.- Parameters:
baseDirectory- directory used to resolve relative secret-file paths
-
ConfigurationValueResolver
public ConfigurationValueResolver(Path baseDirectory, Map<String, String> environment, Function<String, String> systemProperties) Creates a resolver with injectable process sources for platforms and tests.- Parameters:
baseDirectory- directory used to resolve relative secret-file pathsenvironment- environment-variable snapshotsystemProperties- system-property lookup
-
-
Method Details
-
resolve
public Optional<String> resolve(String systemProperty, String environmentVariable, String secretFile, String configuredValue) Resolves the first nonblank value using system property, environment, file, then inline precedence.- Parameters:
systemProperty- optional system-property nameenvironmentVariable- optional environment-variable namesecretFile- optional absolute path or path relative to the configured base directoryconfiguredValue- optional inline value- Returns:
- selected stripped value
-
resolve
public Optional<String> resolve(String environmentVariable, String secretFile, String configuredValue) Resolves environment, file, then inline precedence without a system-property override.- Parameters:
environmentVariable- optional environment-variable namesecretFile- optional secret-file pathconfiguredValue- optional inline value- Returns:
- selected stripped value
-
require
public String require(String label, String systemProperty, String environmentVariable, String secretFile, String configuredValue) Resolves a required value or reports its configuration label.- Parameters:
label- user-facing setting labelsystemProperty- optional system-property nameenvironmentVariable- optional environment-variable namesecretFile- optional secret-file pathconfiguredValue- optional inline value- Returns:
- selected nonblank value
-
readSecretFile
-