Class NtfyConfiguration

java.lang.Object
io.github.pimak.ntfy.micronaut.NtfyConfiguration

@ConfigurationProperties("ntfy") public class NtfyConfiguration extends Object
Binds all ntfy.* application configuration for a Micronaut application. Micronaut's relaxed binding maps kebab-case (e.g. ntfy.app-name), camelCase and underscore variants onto these fields, and converts the Duration fields natively from strings such as 5s, 3m, 500ms or an ISO-8601 value like PT10S.

Key names, types and defaults are deliberately identical to the Spring starter's NtfyProperties, so the same ntfy.* block can be lifted from an application.yml of one framework into the other. Notably async and require-https-for-credentials both default to true, matching the engine defaults.

Getters are plain accessors and are intentionally undocumented one by one; the authoritative description of every knob lives in the project README's configuration reference.

  • Constructor Details

    • NtfyConfiguration

      public NtfyConfiguration()
  • Method Details

    • getUrl

      public String getUrl()
      Base URL of the ntfy server, e.g. https://ntfy.sh. Alerting stays off until both this and getTopic() are set.
      Returns:
      the configured server URL, or null when unset
    • setUrl

      public void setUrl(String url)
      Sets the ntfy server base URL.
      Parameters:
      url - the server URL
    • getTopic

      public String getTopic()
      Topic notifications are published to.
      Returns:
      the topic, or null when unset
    • setTopic

      public void setTopic(String topic)
      Sets the ntfy topic.
      Parameters:
      topic - the topic name
    • getToken

      public String getToken()
      Bearer access token used instead of username/password authentication.
      Returns:
      the token, or null when unset
    • setToken

      public void setToken(String token)
      Sets the bearer access token.
      Parameters:
      token - the access token
    • getUsername

      public String getUsername()
      Username for basic authentication.
      Returns:
      the username, or null when unset
    • setUsername

      public void setUsername(String username)
      Sets the basic-authentication username.
      Parameters:
      username - the username
    • getPassword

      public String getPassword()
      Password for basic authentication.
      Returns:
      the password, or null when unset
    • setPassword

      public void setPassword(String password)
      Sets the basic-authentication password.
      Parameters:
      password - the password
    • getTitle

      public String getTitle()
      Fixed notification title; when unset the engine derives one from the event.
      Returns:
      the title, or null when unset
    • setTitle

      public void setTitle(String title)
      Sets the fixed notification title.
      Parameters:
      title - the title
    • getAppName

      public String getAppName()
      Application name shown in notification bodies to distinguish services sharing a topic.
      Returns:
      the application name, or null when unset
    • setAppName

      public void setAppName(String appName)
      Sets the application name.
      Parameters:
      appName - the application name
    • getMaxStackFrames

      public int getMaxStackFrames()
      Number of stack frames included in a notification body.
      Returns:
      the frame count (default 5)
    • setMaxStackFrames

      public void setMaxStackFrames(int maxStackFrames)
      Sets the number of stack frames included in a notification body.
      Parameters:
      maxStackFrames - the frame count
    • getConnectTimeout

      public Duration getConnectTimeout()
      HTTP connect timeout for publishing.
      Returns:
      the connect timeout (default 5 seconds)
    • setConnectTimeout

      public void setConnectTimeout(Duration connectTimeout)
      Sets the HTTP connect timeout.
      Parameters:
      connectTimeout - the connect timeout
    • getRequestTimeout

      public Duration getRequestTimeout()
      HTTP request timeout for publishing.
      Returns:
      the request timeout (default 10 seconds)
    • setRequestTimeout

      public void setRequestTimeout(Duration requestTimeout)
      Sets the HTTP request timeout.
      Parameters:
      requestTimeout - the request timeout
    • getMaxAlertsPerWindow

      public int getMaxAlertsPerWindow()
      Individual alerts published per suppression window before the engine switches to digesting.
      Returns:
      the per-window alert budget (default 3)
    • setMaxAlertsPerWindow

      public void setMaxAlertsPerWindow(int maxAlertsPerWindow)
      Sets the per-window alert budget.
      Parameters:
      maxAlertsPerWindow - the alert budget
    • getSuppressionWindow

      public Duration getSuppressionWindow()
      Length of the storm-suppression window.
      Returns:
      the suppression window (default 3 minutes)
    • setSuppressionWindow

      public void setSuppressionWindow(Duration suppressionWindow)
      Sets the storm-suppression window.
      Parameters:
      suppressionWindow - the suppression window
    • getErrorPriority

      public String getErrorPriority()
      ntfy priority of individual error notifications.
      Returns:
      the error priority (default high)
    • setErrorPriority

      public void setErrorPriority(String errorPriority)
      Sets the priority of individual error notifications.
      Parameters:
      errorPriority - the ntfy priority
    • getDigestPriority

      public String getDigestPriority()
      ntfy priority of digest notifications.
      Returns:
      the digest priority (default urgent)
    • setDigestPriority

      public void setDigestPriority(String digestPriority)
      Sets the priority of digest notifications.
      Parameters:
      digestPriority - the ntfy priority
    • getErrorTags

      public String getErrorTags()
      Comma-separated ntfy tags attached to individual error notifications.
      Returns:
      the error tags (default rotating_light)
    • setErrorTags

      public void setErrorTags(String errorTags)
      Sets the tags attached to individual error notifications.
      Parameters:
      errorTags - comma-separated ntfy tags
    • getDigestTags

      public String getDigestTags()
      Comma-separated ntfy tags attached to digest notifications.
      Returns:
      the digest tags (default fire)
    • setDigestTags

      public void setDigestTags(String digestTags)
      Sets the tags attached to digest notifications.
      Parameters:
      digestTags - comma-separated ntfy tags
    • getWarnTopic

      public String getWarnTopic()
      The ntfy topic WARN-level events are published to. Unset by default, which keeps alerting ERROR-only; a non-blank value is the entire opt-in for WARN alerting. Set it to the same value as ntfy.topic to alert on warnings through the main topic at a different priority.
      Returns:
      the warn topic, or null when WARN alerting is off
    • setWarnTopic

      public void setWarnTopic(String warnTopic)
      Parameters:
      warnTopic - the ntfy topic for warnings
    • getWarnPriority

      public String getWarnPriority()
      ntfy priority header for WARN alerts and the WARN digest.
      Returns:
      the warn priority
    • setWarnPriority

      public void setWarnPriority(String warnPriority)
      Parameters:
      warnPriority - the ntfy priority value
    • getWarnTags

      public String getWarnTags()
      ntfy tags header for WARN alerts and the WARN digest.
      Returns:
      the comma-separated warn tags
    • setWarnTags

      public void setWarnTags(String warnTags)
      Parameters:
      warnTags - comma-separated ntfy tags
    • getClickUrl

      public String getClickUrl()
      URL opened when a notification is tapped (ntfy Click header).
      Returns:
      the click URL, or null when unset
    • setClickUrl

      public void setClickUrl(String clickUrl)
      Sets the click-through URL.
      Parameters:
      clickUrl - the URL opened when a notification is tapped
    • getActions

      public String getActions()
      Action buttons as a raw ntfy Actions header value (short format, e.g. "view, View logs, https://grafana.example.com/d/abc").
      Returns:
      the actions header value, or null when unset
    • setActions

      public void setActions(String actions)
      Sets the raw ntfy Actions header value.
      Parameters:
      actions - the actions header value
    • getLocale

      public String getLocale()
      Language of notification bodies and diagnostics as a BCP 47 tag (e.g. fr, de-DE). Defaults to English; an unknown/unshipped locale silently uses English.
      Returns:
      the language tag, or null when unset
    • setLocale

      public void setLocale(String locale)
      Sets the notification language as a BCP 47 tag.
      Parameters:
      locale - the language tag
    • getExcludedLoggers

      public String getExcludedLoggers()
      Comma-separated logger-name prefixes excluded from alerting.
      Returns:
      the excluded prefixes, or null when unset
    • setExcludedLoggers

      public void setExcludedLoggers(String excludedLoggers)
      Sets the comma-separated logger-name prefixes excluded from alerting.
      Parameters:
      excludedLoggers - the excluded prefixes
    • getExcludedExceptionTypes

      public String getExcludedExceptionTypes()
      Comma-separated fully qualified exception class names. An event whose cause chain contains any of them never alerts — matched anywhere in the chain, not just on the surface throwable.
      Returns:
      the excluded types, or null when unset
    • setExcludedExceptionTypes

      public void setExcludedExceptionTypes(String excludedExceptionTypes)
      Sets the comma-separated fully qualified exception class names excluded from alerting.
      Parameters:
      excludedExceptionTypes - the excluded types
    • isCache

      public boolean isCache()
      false asks the server not to store the message (Cache: no). Subscribers who are offline at that moment never receive it. Default true.
      Returns:
      whether the server may cache published messages
    • setCache

      public void setCache(boolean cache)
      Sets whether the server may cache published messages.
      Parameters:
      cache - false to send Cache: no
    • isFirebase

      public boolean isFirebase()
      false asks the server not to forward the message to Firebase ( Firebase: no). Default true.
      Returns:
      whether the server may forward published messages to FCM
    • setFirebase

      public void setFirebase(boolean firebase)
      Sets whether the server may forward published messages to FCM.
      Parameters:
      firebase - false to send Firebase: no
    • getIcon

      public String getIcon()
      URL of the icon shown beside the notification (ntfy Icon header). Must be an http/https URL; a value that is not one is dropped — reported at startup on the alerting path, silently by the injectable NtfyClient, which has no diagnostics channel. ntfy renders JPEG and PNG only, but that is a property of the bytes served, not of the path, so a URL whose extension names another format is warned about and still sent.
      Returns:
      the icon URL, or null when unset
    • setIcon

      public void setIcon(String icon)
      Sets the notification icon URL.
      Parameters:
      icon - the icon URL
    • getIconsByLogger

      public String getIconsByLogger()
      Per-logger icon overrides as prefix=url pairs separated by commas. The longest prefix matching an alert's logger wins; anything unmatched keeps the default icon. Alerts only — a notification has no logger to match on.
      Returns:
      the comma-separated pairs, or null when unset
    • setIconsByLogger

      public void setIconsByLogger(String iconsByLogger)
      Sets the per-logger icon overrides.
      Parameters:
      iconsByLogger - the comma-separated prefix=url pairs
    • getIncludeMdcKeys

      public String getIncludeMdcKeys()
      Comma-separated allow-list of MDC keys whose values are rendered into alert bodies, one key: value line each. Empty by default, and there is deliberately no wildcard form: MDC content is application-owned and free-form, so only the keys named here are ever published.
      Returns:
      the allow-listed MDC keys, or null when unset
    • setIncludeMdcKeys

      public void setIncludeMdcKeys(String includeMdcKeys)
      Sets the comma-separated allow-list of MDC keys rendered into alert bodies.
      Parameters:
      includeMdcKeys - the allow-listed MDC keys
    • isEnabled

      public boolean isEnabled()
      Master switch for the integration. When false no appender is installed and the NtfyClient bean — still injectable — is built from an inactive configuration.
      Returns:
      whether ntfy alerting is enabled (default true)
    • setEnabled

      public void setEnabled(boolean enabled)
      Enables or disables the integration.
      Parameters:
      enabled - whether ntfy alerting is enabled
    • isAsync

      public boolean isAsync()
      Asynchronous (offloaded) delivery, so a slow or unreachable ntfy server never blocks the logging thread.
      Returns:
      whether async delivery is on (default true)
    • setAsync

      public void setAsync(boolean async)
      Turns asynchronous delivery on or off.
      Parameters:
      async - whether async delivery is on
    • getAsyncQueueCapacity

      public int getAsyncQueueCapacity()
      Bounded async delivery queue capacity; only consulted when isAsync() is true.
      Returns:
      the queue capacity (default 1024)
    • setAsyncQueueCapacity

      public void setAsyncQueueCapacity(int asyncQueueCapacity)
      Sets the bounded async delivery queue capacity.
      Parameters:
      asyncQueueCapacity - the queue capacity
    • isRequireHttpsForCredentials

      public boolean isRequireHttpsForCredentials()
      Strict transport mode: refuse engine activation (rather than only warn) when credentials would be sent over a cleartext http:// endpoint.
      Returns:
      whether HTTPS is required for credentials (default true)
    • setRequireHttpsForCredentials

      public void setRequireHttpsForCredentials(boolean requireHttpsForCredentials)
      Turns the strict credentials-over-HTTPS requirement on or off.
      Parameters:
      requireHttpsForCredentials - whether HTTPS is required for credentials
    • getStartupPing

      public String getStartupPing()
      Opt-in startup self-test verifying at boot that the configured endpoint, credentials and topic actually work — instead of finding out when the first real error alert fails to deliver.
      Returns:
      "off" (default), "probe" or "publish"
    • setStartupPing

      public void setStartupPing(String startupPing)
      Selects the startup self-test mode.

      Bound as a String rather than the StartupPingMode enum on purpose: Micronaut fails bean instantiation on an unconvertible enum value, which would turn one typo in application.yml into a failed startup. The core parses it leniently and warns instead, matching every other surface.

      Parameters:
      startupPing - "off", "probe" or "publish"
    • isStartupPingFailFast

      public boolean isStartupPingFailFast()
      Whether a failed startup self-test aborts application startup instead of only warning. Enabling it also makes the self-test run inline, adding at most connect+request timeout to boot.
      Returns:
      whether to fail fast (default false)
    • setStartupPingFailFast

      public void setStartupPingFailFast(boolean startupPingFailFast)
      Turns fail-fast on a failed startup self-test on or off.
      Parameters:
      startupPingFailFast - whether a failed self-test aborts startup
    • getStartupPingWarn

      public String getStartupPingWarn()
      Startup self-test for the optional WARN route, independent of getStartupPing().
      Returns:
      "off" (default), "probe" or "publish"
    • setStartupPingWarn

      public void setStartupPingWarn(String startupPingWarn)
      Selects the WARN-route self-test mode; bound as a String for the same reason as setStartupPing(String).
      Parameters:
      startupPingWarn - "off", "probe" or "publish"
    • isStartupPingNotifyFailures

      public boolean isStartupPingNotifyFailures()
      Whether a failed self-test is announced on a route that passed.
      Returns:
      whether to notify failures (default true)
    • setStartupPingNotifyFailures

      public void setStartupPingNotifyFailures(boolean startupPingNotifyFailures)
      Turns the failure notification on or off.
      Parameters:
      startupPingNotifyFailures - whether to announce failures on a healthy route