Class PropertiesConfigLoader

java.lang.Object
com.loomcache.server.config.PropertiesConfigLoader

public class PropertiesConfigLoader extends Object
Loads configuration from .properties files and maps them to LoomConfig.

This loader supports hierarchical Java properties format (not YAML): loomcache.node-id=node-1 loomcache.node.host=node-1.internal.example.com loomcache.bind-address=0.0.0.0 loomcache.port=5701 loomcache.cluster.seeds=host1:5701,host2:5702 loomcache.raft.election-timeout-ms=60000 etc. loomcache.auth.jaas.enabled=true loomcache.auth.jaas.login-context=LoomCache loomcache.auth.jaas.login-module.0.class=com.example.security.LoomLoginModule loomcache.auth.jaas.login-module.0.flag=required loomcache.auth.jaas.login-module.0.option.users-file=/etc/loomcache/users.properties loomcache.auth.ldap.enabled=true loomcache.auth.ldap.user-provider=ldap://ldap.example.com/ou=people,dc=example,dc=com loomcache.auth.ldap.auth-identity=uid={USERNAME},ou=people,dc=example,dc=com loomcache.auth.kerberos.enabled=true loomcache.auth.kerberos.login-module-class=com.sun.security.auth.module.Krb5LoginModule loomcache.auth.kerberos.principal=loomcache/[email protected] loomcache.auth.kerberos.key-tab=/etc/security/keytabs/loomcache.keytab loomcache.auth.token.enabled=true loomcache.auth.token.credentials.ci-bot.sha256=invalid input: '<'sha256-token-fingerprint> loomcache.auth.token.credentials.ci-bot.username=ci-bot loomcache.auth.token.credentials.ci-bot.roles=admin loomcache.executor.max-task-payload-bytes=1048576 loomcache.server.executor.max-task-payload-bytes=1048576

Configuration sources (in priority order):

  1. CLI arguments (passed to builder)
  2. File specified by --config=path argument
  3. ./loomcache.properties in current directory
  4. loomcache.properties from classpath
  5. Built-in defaults
Since:
1.0
  • Constructor Details

    • PropertiesConfigLoader

      public PropertiesConfigLoader()
  • Method Details

    • loadConfig

      public static LoomConfig.Builder loadConfig(@Nullable String configFilePath)
      Load configuration from multiple sources, with proper precedence.
      Parameters:
      configFilePath - optional path to config file (null to use defaults)
      Returns:
      LoomConfig.Builder with loaded properties
    • validateConfiguration

      public static void validateConfiguration(LoomConfig config, boolean allowStandalone)
      Validate the resolved configuration and perform startup checks.

      BLK-2026-04-22-009: previously these checks only logged warnings, so a misconfigured deployment (port already bound, unwritable WAL dir, empty seed list) would still attempt to boot — and either crash later in opaque ways or, worse, silently come up as a single-node cluster on its own. This method now fails fast.

      Standalone-mode (empty seed list) is permitted only if allowStandalone is true, which is opt-in via --allow-standalone on the CacheNodeMain CLI.

      Parameters:
      config - The resolved configuration
      allowStandalone - Whether an empty cluster-members list is permitted
      Throws:
      IllegalStateException - if validation fails
    • validateConfiguration

      public static void validateConfiguration(LoomConfig config)
      Backwards-compatible overload that defers to validateConfiguration(LoomConfig, boolean) with allowStandalone=false. Existing call sites that have not opted into the stricter contract get the safe default.
      Parameters:
      config - The resolved configuration
      Throws:
      IllegalStateException - if validation fails