Class NtfyConfiguration
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAction buttons as a raw ntfyActionsheader value (short format, e.g.Application name shown in notification bodies to distinguish services sharing a topic.intBounded async delivery queue capacity; only consulted whenisAsync()istrue.URL opened when a notification is tapped (ntfyClickheader).HTTP connect timeout for publishing.ntfy priority of digest notifications.Comma-separated ntfy tags attached to digest notifications.ntfy priority of individual error notifications.Comma-separated ntfy tags attached to individual error notifications.Comma-separated fully qualified exception class names.Comma-separated logger-name prefixes excluded from alerting.getIcon()URL of the icon shown beside the notification (ntfyIconheader).Per-logger icon overrides asprefix=urlpairs separated by commas.Comma-separated allow-list of MDC keys whose values are rendered into alert bodies, onekey: valueline each.Language of notification bodies and diagnostics as a BCP 47 tag (e.g.intIndividual alerts published per suppression window before the engine switches to digesting.intNumber of stack frames included in a notification body.Password for basic authentication.HTTP request timeout for publishing.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.Startup self-test for the optional WARN route, independent ofgetStartupPing().Length of the storm-suppression window.getTitle()Fixed notification title; when unset the engine derives one from the event.getToken()Bearer access token used instead of username/password authentication.getTopic()Topic notifications are published to.getUrl()Base URL of the ntfy server, e.g.Username for basic authentication.ntfy priority header for WARN alerts and the WARN digest.ntfy tags header for WARN alerts and the WARN digest.The ntfy topic WARN-level events are published to.booleanisAsync()Asynchronous (offloaded) delivery, so a slow or unreachable ntfy server never blocks the logging thread.booleanisCache()falseasks the server not to store the message (Cache: no).booleanMaster switch for the integration.booleanfalseasks the server not to forward the message to Firebase (Firebase: no).booleanStrict transport mode: refuse engine activation (rather than only warn) when credentials would be sent over a cleartexthttp://endpoint.booleanWhether a failed startup self-test aborts application startup instead of only warning.booleanWhether a failed self-test is announced on a route that passed.voidsetActions(String actions) Sets the raw ntfyActionsheader value.voidsetAppName(String appName) Sets the application name.voidsetAsync(boolean async) Turns asynchronous delivery on or off.voidsetAsyncQueueCapacity(int asyncQueueCapacity) Sets the bounded async delivery queue capacity.voidsetCache(boolean cache) Sets whether the server may cache published messages.voidsetClickUrl(String clickUrl) Sets the click-through URL.voidsetConnectTimeout(Duration connectTimeout) Sets the HTTP connect timeout.voidsetDigestPriority(String digestPriority) Sets the priority of digest notifications.voidsetDigestTags(String digestTags) Sets the tags attached to digest notifications.voidsetEnabled(boolean enabled) Enables or disables the integration.voidsetErrorPriority(String errorPriority) Sets the priority of individual error notifications.voidsetErrorTags(String errorTags) Sets the tags attached to individual error notifications.voidsetExcludedExceptionTypes(String excludedExceptionTypes) Sets the comma-separated fully qualified exception class names excluded from alerting.voidsetExcludedLoggers(String excludedLoggers) Sets the comma-separated logger-name prefixes excluded from alerting.voidsetFirebase(boolean firebase) Sets whether the server may forward published messages to FCM.voidSets the notification icon URL.voidsetIconsByLogger(String iconsByLogger) Sets the per-logger icon overrides.voidsetIncludeMdcKeys(String includeMdcKeys) Sets the comma-separated allow-list of MDC keys rendered into alert bodies.voidSets the notification language as a BCP 47 tag.voidsetMaxAlertsPerWindow(int maxAlertsPerWindow) Sets the per-window alert budget.voidsetMaxStackFrames(int maxStackFrames) Sets the number of stack frames included in a notification body.voidsetPassword(String password) Sets the basic-authentication password.voidsetRequestTimeout(Duration requestTimeout) Sets the HTTP request timeout.voidsetRequireHttpsForCredentials(boolean requireHttpsForCredentials) Turns the strict credentials-over-HTTPS requirement on or off.voidsetStartupPing(String startupPing) Selects the startup self-test mode.voidsetStartupPingFailFast(boolean startupPingFailFast) Turns fail-fast on a failed startup self-test on or off.voidsetStartupPingNotifyFailures(boolean startupPingNotifyFailures) Turns the failure notification on or off.voidsetStartupPingWarn(String startupPingWarn) Selects the WARN-route self-test mode; bound as aStringfor the same reason assetStartupPing(String).voidsetSuppressionWindow(Duration suppressionWindow) Sets the storm-suppression window.voidSets the fixed notification title.voidSets the bearer access token.voidSets the ntfy topic.voidSets the ntfy server base URL.voidsetUsername(String username) Sets the basic-authentication username.voidsetWarnPriority(String warnPriority) voidsetWarnTags(String warnTags) voidsetWarnTopic(String warnTopic)
-
Constructor Details
-
NtfyConfiguration
public NtfyConfiguration()
-
-
Method Details
-
getUrl
Base URL of the ntfy server, e.g.https://ntfy.sh. Alerting stays off until both this andgetTopic()are set.- Returns:
- the configured server URL, or
nullwhen unset
-
setUrl
Sets the ntfy server base URL.- Parameters:
url- the server URL
-
getTopic
Topic notifications are published to.- Returns:
- the topic, or
nullwhen unset
-
setTopic
Sets the ntfy topic.- Parameters:
topic- the topic name
-
getToken
Bearer access token used instead of username/password authentication.- Returns:
- the token, or
nullwhen unset
-
setToken
Sets the bearer access token.- Parameters:
token- the access token
-
getUsername
Username for basic authentication.- Returns:
- the username, or
nullwhen unset
-
setUsername
Sets the basic-authentication username.- Parameters:
username- the username
-
getPassword
Password for basic authentication.- Returns:
- the password, or
nullwhen unset
-
setPassword
Sets the basic-authentication password.- Parameters:
password- the password
-
getTitle
Fixed notification title; when unset the engine derives one from the event.- Returns:
- the title, or
nullwhen unset
-
setTitle
Sets the fixed notification title.- Parameters:
title- the title
-
getAppName
Application name shown in notification bodies to distinguish services sharing a topic.- Returns:
- the application name, or
nullwhen unset
-
setAppName
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
HTTP connect timeout for publishing.- Returns:
- the connect timeout (default 5 seconds)
-
setConnectTimeout
Sets the HTTP connect timeout.- Parameters:
connectTimeout- the connect timeout
-
getRequestTimeout
HTTP request timeout for publishing.- Returns:
- the request timeout (default 10 seconds)
-
setRequestTimeout
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
Length of the storm-suppression window.- Returns:
- the suppression window (default 3 minutes)
-
setSuppressionWindow
Sets the storm-suppression window.- Parameters:
suppressionWindow- the suppression window
-
getErrorPriority
ntfy priority of individual error notifications.- Returns:
- the error priority (default
high)
-
setErrorPriority
Sets the priority of individual error notifications.- Parameters:
errorPriority- the ntfy priority
-
getDigestPriority
ntfy priority of digest notifications.- Returns:
- the digest priority (default
urgent)
-
setDigestPriority
Sets the priority of digest notifications.- Parameters:
digestPriority- the ntfy priority
-
getErrorTags
Comma-separated ntfy tags attached to individual error notifications.- Returns:
- the error tags (default
rotating_light)
-
setErrorTags
Sets the tags attached to individual error notifications.- Parameters:
errorTags- comma-separated ntfy tags
-
getDigestTags
Comma-separated ntfy tags attached to digest notifications.- Returns:
- the digest tags (default
fire)
-
setDigestTags
Sets the tags attached to digest notifications.- Parameters:
digestTags- comma-separated ntfy tags
-
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 asntfy.topicto alert on warnings through the main topic at a different priority.- Returns:
- the warn topic, or
nullwhen WARN alerting is off
-
setWarnTopic
- Parameters:
warnTopic- the ntfy topic for warnings
-
getWarnPriority
ntfy priority header for WARN alerts and the WARN digest.- Returns:
- the warn priority
-
setWarnPriority
- Parameters:
warnPriority- the ntfy priority value
-
getWarnTags
ntfy tags header for WARN alerts and the WARN digest.- Returns:
- the comma-separated warn tags
-
setWarnTags
- Parameters:
warnTags- comma-separated ntfy tags
-
getClickUrl
URL opened when a notification is tapped (ntfyClickheader).- Returns:
- the click URL, or
nullwhen unset
-
setClickUrl
Sets the click-through URL.- Parameters:
clickUrl- the URL opened when a notification is tapped
-
getActions
Action buttons as a raw ntfyActionsheader value (short format, e.g."view, View logs, https://grafana.example.com/d/abc").- Returns:
- the actions header value, or
nullwhen unset
-
setActions
Sets the raw ntfyActionsheader value.- Parameters:
actions- the actions header value
-
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
nullwhen unset
-
setLocale
Sets the notification language as a BCP 47 tag.- Parameters:
locale- the language tag
-
getExcludedLoggers
Comma-separated logger-name prefixes excluded from alerting.- Returns:
- the excluded prefixes, or
nullwhen unset
-
setExcludedLoggers
Sets the comma-separated logger-name prefixes excluded from alerting.- Parameters:
excludedLoggers- the excluded prefixes
-
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
nullwhen unset
-
setExcludedExceptionTypes
Sets the comma-separated fully qualified exception class names excluded from alerting.- Parameters:
excludedExceptionTypes- the excluded types
-
isCache
public boolean isCache()falseasks the server not to store the message (Cache: no). Subscribers who are offline at that moment never receive it. Defaulttrue.- Returns:
- whether the server may cache published messages
-
setCache
public void setCache(boolean cache) Sets whether the server may cache published messages.- Parameters:
cache-falseto sendCache: no
-
isFirebase
public boolean isFirebase()falseasks the server not to forward the message to Firebase (Firebase: no). Defaulttrue.- 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-falseto sendFirebase: no
-
getIcon
URL of the icon shown beside the notification (ntfyIconheader). Must be anhttp/httpsURL; a value that is not one is dropped — reported at startup on the alerting path, silently by the injectableNtfyClient, 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
nullwhen unset
-
setIcon
Sets the notification icon URL.- Parameters:
icon- the icon URL
-
getIconsByLogger
Per-logger icon overrides asprefix=urlpairs 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
nullwhen unset
-
setIconsByLogger
Sets the per-logger icon overrides.- Parameters:
iconsByLogger- the comma-separated prefix=url pairs
-
getIncludeMdcKeys
Comma-separated allow-list of MDC keys whose values are rendered into alert bodies, onekey: valueline 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
nullwhen unset
-
setIncludeMdcKeys
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. Whenfalseno appender is installed and theNtfyClientbean — 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 whenisAsync()istrue.- 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 cleartexthttp://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
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
Selects the startup self-test mode.Bound as a
Stringrather than theStartupPingModeenum on purpose: Micronaut fails bean instantiation on an unconvertible enum value, which would turn one typo inapplication.ymlinto 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
Startup self-test for the optional WARN route, independent ofgetStartupPing().- Returns:
"off"(default),"probe"or"publish"
-
setStartupPingWarn
Selects the WARN-route self-test mode; bound as aStringfor the same reason assetStartupPing(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
-