Class ConfigLoader

java.lang.Object
io.github.pimak.ntfy.core.ConfigLoader

public final class ConfigLoader extends Object
Resolves an NtfyConfig from the ambient environment. This is the ONLY class in ntfy-core permitted to read System.getenv(java.lang.String) — every other class receives its configuration through an already-built NtfyConfig, keeping environment access to a single sanctioned reader.

Each field is resolved by precedence, highest first:

  1. JVM system property ntfy.<kebab-key> (e.g. -Dntfy.app-name=svc);
  2. environment variable NTFY_<UPPER_SNAKE_KEY> (e.g. NTFY_APP_NAME);
  3. classpath ntfy.properties entry ntfy.<kebab-key>;
  4. the built-in default carried by NtfyConfig.Builder.

Exception: allow-classpath-endpoint is deliberately resolved from the system-property and environment layers only — never the classpath ntfy.properties file — so a file shipped on the classpath can never grant itself the trust to auto-activate alerting (see load()).

  • Method Details

    • load

      public static NtfyConfig load()
      Loads configuration from live system properties, environment variables, and a classpath ntfy.properties (if present), applying the precedence documented on this class.