Class ConfigurationValueResolver

java.lang.Object
com.iantapply.orchestra.configuration.ConfigurationValueResolver

public final class ConfigurationValueResolver extends Object
Resolves configured values consistently from system properties, environment, files, and inline values.
  • Constructor Details

    • ConfigurationValueResolver

      public ConfigurationValueResolver(Path baseDirectory)
      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 paths
      environment - environment-variable snapshot
      systemProperties - 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 name
      environmentVariable - optional environment-variable name
      secretFile - optional absolute path or path relative to the configured base directory
      configuredValue - 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 name
      secretFile - optional secret-file path
      configuredValue - 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 label
      systemProperty - optional system-property name
      environmentVariable - optional environment-variable name
      secretFile - optional secret-file path
      configuredValue - optional inline value
      Returns:
      selected nonblank value
    • readSecretFile

      public Optional<String> readSecretFile(String configuredPath)
      Reads an optional UTF-8 secret file, resolving relative paths against the base directory.
      Parameters:
      configuredPath - optional secret-file path
      Returns:
      stripped file content, or empty when no path is configured