Class ConfigResolver

java.lang.Object
app.l2nx.gs.adapter.core.config.ConfigResolver

public final class ConfigResolver extends Object
Resolves adapter configuration from a two-source chain (per key), file-first:
  1. Properties file — either the path given by -Dl2nx.config-file=<path> (operator-preferred; absolute or relative to the JVM working directory), or l2nx.properties in the JVM working directory of the host application as a fallback when l2nx.config-file is unset.
  2. JVM system property (e.g. -Dl2nx.gs-key=...) — consulted only when the file does not provide the key.
Pure JDK — no Spring, no SnakeYAML, no third-party config library. Environment-variable resolution is intentionally absent; file is the preferred medium and is authoritative when present. The file is read as UTF-8.

Missing-file semantics:

  • -Dl2nx.config-file explicitly set but missing / unreadable / malformed path → fail loud with IllegalStateException; the operator's intent is clear.
  • -Dl2nx.config-file unset and l2nx.properties not present in the JVM working directory → empty Properties (graceful — sysprop fallback may still provide the keys).
  • Constructor Details

    • ConfigResolver

      public ConfigResolver()
  • Method Details

    • resolve

      public AdapterConfig resolve()
    • resolveEventsConfig

      public EventsConfig resolveEventsConfig()
    • resolveCommandsConfig

      public CommandsConfig resolveCommandsConfig()
    • resolveString

      public Optional<String> resolveString(String key)
    • resolveBoolean

      public boolean resolveBoolean(String key, boolean defaultValue)
    • resolveServerKey

      public String resolveServerKey()
    • resolvePlatformUrl

      public String resolvePlatformUrl()
    • resolveEnabled

      public boolean resolveEnabled()
    • resolveAdapterVersion

      public String resolveAdapterVersion()