Enum Class StartupPingMode

java.lang.Object
java.lang.Enum<StartupPingMode>
io.github.pimak.ntfy.core.StartupPingMode
All Implemented Interfaces:
Serializable, Comparable<StartupPingMode>, Constable

public enum StartupPingMode extends Enum<StartupPingMode>
What the opt-in startup self-test does when AlertEngine.start() finishes activating.

An ntfy alerting backend is silent by design — it only speaks when something goes wrong — so a revoked token, a renamed topic or a blocked egress route all look identical at boot: nothing happens. start() validates only what it can check locally (URL syntax, topic charset, auth-pair completeness, timeouts) and never touches the network, so it cannot tell "correctly configured" apart from "token revoked last week". This flag opts into an actual round-trip that settles the question at deploy time instead of during the first real incident.

OFF is the default and is a true no-op: no request, and no diagnostic line either, so the default path's diagnostic stream stays byte-identical to a build without this feature.

  • Enum Constant Details

    • OFF

      public static final StartupPingMode OFF
      No self-test. Default; emits no request and no diagnostic.
    • PROBE

      public static final StartupPingMode PROBE
      Read-only reachability check — GET {url}/{topic}/json?poll=1&since=none. Validates DNS, TLS, that the endpoint really is an ntfy server, that the topic is addressable, and that the credentials are accepted for read. Publishes nothing, so subscribers see no noise.

      Known blind spot: ntfy ACLs separate read from write, so a read-only token (or one revoked for writes only) passes this check and still fails every real alert. On an open server, where reads are anonymous, a probe proves nothing at all about credentials. PROBE answers "can I reach this server?"; only PUBLISH answers "will my alerts actually be delivered?".

    • PUBLISH

      public static final StartupPingMode PUBLISH
      Posts a real low-priority test notification through the production publish path, so the exact code, headers and credentials that carry real alerts are exercised. The cost is one notification per boot for every subscriber of the topic.
  • Method Details

    • values

      public static StartupPingMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static StartupPingMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromValue

      public static StartupPingMode fromValue(String value)
      Parses a configured value case-insensitively, returning null — never throwing — when the value matches no constant.

      null rather than a silent fallback to OFF on purpose: ConfigLoader and the adapters keep the default for a malformed value (matching how a bad int or duration is handled) but must still be able to tell "unset" from "misspelled" so a typo like startup-ping=prob is warned about instead of masquerading as a deliberate off.