Class YamlConfigLoader
java.lang.Object
com.loomcache.server.config.YamlConfigLoader
Unified configuration loader supporting both YAML (.yml/.yaml) and properties (.properties) formats.
Supported configuration formats:
- YAML (loomcache.yml):
loomcache: node: id: node-1 host: node-1.internal.example.com bind-address: 0.0.0.0 port: 5701 cluster: members: - "127.0.0.1:5701" - "127.0.0.1:5702" max-parallel-migrations: 10 migration: max-parallel-migrations: 10 executor: max-task-payload-bytes: 1048576 raft: election-timeout-ms: 60000 heartbeat-interval-ms: 5000 persistence: enabled: false wal-directory: persistence backup-dir: ./backup hot-backup-interval-seconds: 3600 snapshot-threshold: 10000 cluster-data-recovery-policy: FULL validation-timeout-seconds: 120 data-load-timeout-seconds: 900 parallelism: 2 cache: max-map-entries: 0 eviction-policy: NONE max-memory-bytes: 1073741824 idempotency: ttl-ms: 60000 health: check-interval-ms: 5000 metrics-port: 9090 icmp: enabled: true timeout-ms: 1000 interval-ms: 1000 max-attempts: 2 fail-fast-on-startup: false diagnostics: slow-operation: enabled: false threshold-ms: 10000 sample-interval-ms: 1000 max-records: 1024 max-stack-frames: 32 auth: enabled: true jaas: enabled: true login-context: LoomCache role-principal-classes: [com.example.security.RolePrincipal] login-modules: - class: com.example.security.LoomLoginModule flag: required options: users-file: /etc/loomcache/users.properties ldap: enabled: true user-provider: ldap://ldap.example.com/ou=people,dc=example,dc=com auth-identity: uid={USERNAME},ou=people,dc=example,dc=com authz-identity: "{departmentNumber}" kerberos: enabled: true login-module-class: com.sun.security.auth.module.Krb5LoginModule principal: loomcache/[email protected] key-tab: /etc/security/keytabs/loomcache.keytab use-key-tab: true token: enabled: true credentials: ci-bot: sha256: 2bb80d537b1da3e38bd30361aa855686bde0ba5fbda3e13d3a0c742b7725e18f username: ci-bot roles: [admin] - Properties (loomcache.properties):
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=localhost:5701,localhost:5702 loomcache.migration.max-parallel-migrations=10 loomcache.executor.max-task-payload-bytes=1048576 loomcache.raft.election-timeout-ms=60000 loomcache.raft.heartbeat-interval-ms=5000 loomcache.health-check-interval-ms=5000 loomcache.metrics-port=9090 loomcache.diagnostics.slow-operation.enabled=true loomcache.diagnostics.slow-operation.threshold-ms=10000 loomcache.persistence.enabled=false loomcache.persistence.wal-directory=persistence loomcache.persistence.backup-dir=./backup loomcache.persistence.hot-backup-interval-seconds=3600 loomcache.persistence.snapshot-threshold=10000 loomcache.persistence.cluster-data-recovery-policy=FULL loomcache.persistence.validation-timeout-seconds=120 loomcache.persistence.data-load-timeout-seconds=900 loomcache.persistence.parallelism=2 loomcache.eviction.policy=NONE loomcache.eviction.max-entries=0 loomcache.eviction.max-memory-bytes=1073741824 loomcache.auth.jaas.enabled=true loomcache.auth.jaas.login-module.0.class=com.example.security.LoomLoginModule loomcache.auth.ldap.enabled=true loomcache.auth.ldap.user-provider=ldap://ldap.example.com/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.token.enabled=true
Configuration sources (in priority order):
- CLI arguments (passed to builder)
- Environment variables (LOOMCACHE_NODE_ID, LOOMCACHE_PORT, etc.)
- File specified by --config argument (.yml or .properties)
- ./loomcache.yml or ./loomcache.properties in current directory
- classpath loomcache.yml or loomcache.properties
- Built-in defaults
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LoomConfig.BuilderloadConfig(@Nullable String configFilePath) Load configuration from multiple sources with proper precedence.static voidvalidateConfiguration(LoomConfig config) Validate configuration after loading.
-
Constructor Details
-
YamlConfigLoader
public YamlConfigLoader()
-
-
Method Details
-
loadConfig
Load configuration from multiple sources with proper precedence. Supports both YAML (.yml/.yaml) and properties (.properties) files.- Parameters:
configFilePath- optional path to config file (null to use defaults)- Returns:
- LoomConfig.Builder with loaded properties
-
validateConfiguration
Validate configuration after loading.- Parameters:
config- Configuration to validate- Throws:
IllegalArgumentException- if configuration is invalid
-