Class NtfyConfig.Builder
- Enclosing class:
NtfyConfig
NtfyConfig; every setter returns this.-
Method Summary
Modifier and TypeMethodDescriptionactions(List<NtfyAction> actions) Sets action buttons from typedNtfyActions, serialized to the ntfyActionsheader viaNtfyActionSerializer. ntfy caps a notification at three actions; extra entries andnullelements are dropped.actionsHeader(String actionsHeader) Sets action buttons from a raw, pre-formatted ntfyActionsheader value (the short "simple" format, e.g.allowClasspathEndpoint(boolean allowClasspathEndpoint) Explicit opt-in for activating from a classpath-only endpoint URL; seeNtfyConfig.isAllowClasspathEndpoint().asyncEnabled(boolean asyncEnabled) Toggles asynchronous (offloaded) delivery of individual error alerts.asyncQueueCapacity(int asyncQueueCapacity) Sets the bounded async delivery queue capacity (seeNtfyConfig.getAsyncQueueCapacity()).build()cache(boolean cache) falseasks the server not to store the message (Cache: no), at the cost of every subscriber who is not connected at that moment.Setscachefrom a raw configuration string, the spelling every flat surface hands over — an XML attribute, an environment variable, a properties entry.URL opened when a notification is tapped (ntfyClickheader);nullto omit.connectTimeout(Duration connectTimeout) digestPriority(String digestPriority) digestTags(String digestTags) enabled(boolean enabled) endpointFromClasspathFile(boolean endpointFromClasspathFile) SeeNtfyConfig.isEndpointFromClasspathFile(); set byConfigLoaderonly.errorPriority(String errorPriority) excludedExceptionTypes(List<String> types) Sets the excluded exception types from an explicit list of fully qualified class names (defensively copied, null-safe, blanks dropped).Convenience: sets the excluded exception types from a single comma-separated string of fully qualified class names, trimming each entry and dropping blanks.excludedLoggerPrefixes(List<String> prefixes) Sets the excluded logger prefixes from an explicit list (defensively copied, null-safe).excludedLoggers(String csv) Convenience: sets the excluded logger prefixes from a single comma-separated string, trimming each entry and dropping blanks.firebase(boolean firebase) falseasks the server not to forward the message to Firebase (Firebase: no), at the cost of push latency on the Google Play Android client.firebasefrom a raw configuration string.Sets the notification icon URL (ntfyIconheader).iconsByLoggerPrefix(Map<String, String> icons) Sets the logger-prefix → icon-URL table (defensively copied, null-safe).Convenience: the same table as a single string,prefix=urlpairs separated by commas — the spelling every adapter's flat configuration surface uses.includeMdcKeys(List<String> keys) Sets the MDC-key allow-list from an explicit list (defensively copied, null-safe); anulllist clears it.includeMdcKeysCsv(String csv) Convenience: sets the MDC-key allow-list from a single comma-separated string, trimming each entry and dropping blanks.Convenience overload that parses a BCP 47 language tag (e.g.Sets the language of notification bodies and diagnostics (seeNtfyConfig.getLocale()).maxAlertsPerWindow(int maxAlertsPerWindow) maxStackFrames(int maxStackFrames) requestTimeout(Duration requestTimeout) requireHttpsForCredentials(boolean requireHttpsForCredentials) Toggles refusing activation when credentials would traverse a cleartexthttp://endpoint.startupPing(StartupPingMode startupPing) Selects the opt-in startup self-test mode (seeNtfyConfig.getStartupPing()).startupPing(String startupPing) Convenience overload parsing a configured string (off/probe/publish, case-insensitive) so the XML and properties surfaces bind without carrying their own parser.startupPingFailFast(boolean startupPingFailFast) Toggles aborting application startup when the self-test fails; seeNtfyConfig.isStartupPingFailFast().startupPingNotifyFailures(boolean startupPingNotifyFailures) Toggles announcing a failed self-test on a route that passed; seeNtfyConfig.isStartupPingNotifyFailures().startupPingWarn(StartupPingMode startupPingWarn) Selects the startup self-test mode for the WARN route (seeNtfyConfig.getStartupPingWarn()).startupPingWarn(String startupPingWarn) Lenient string overload forstartup-ping-warn; seestartupPing(String).suppressionWindow(Duration suppressionWindow) warnPriority(String warnPriority) ntfyPriorityheader for WARN alerts and the WARN digest; defaultdefault.ntfyTagsheader for WARN alerts and the WARN digest; defaultwarning.The topic WARN-level events are published to.warnTopicFromClasspathFile(boolean warnTopicFromClasspathFile) SeeNtfyConfig.isWarnTopicFromClasspathFile(); set byConfigLoaderonly.
-
Method Details
-
url
-
topic
-
token
-
username
-
password
-
title
-
appName
-
maxStackFrames
-
connectTimeout
-
requestTimeout
-
maxAlertsPerWindow
-
suppressionWindow
-
errorPriority
-
digestPriority
-
errorTags
-
digestTags
-
warnTopic
The topic WARN-level events are published to. Setting it to a non-blank value is the entire opt-in for WARN alerting — seeNtfyConfig.isWarnRoutingEnabled().null/blank (the default) keeps alerting ERROR-only. -
warnPriority
ntfyPriorityheader for WARN alerts and the WARN digest; defaultdefault. -
warnTags
ntfyTagsheader for WARN alerts and the WARN digest; defaultwarning. -
warnTopicFromClasspathFile
SeeNtfyConfig.isWarnTopicFromClasspathFile(); set byConfigLoaderonly. -
clickUrl
URL opened when a notification is tapped (ntfyClickheader);nullto omit. -
actionsHeader
Sets action buttons from a raw, pre-formatted ntfyActionsheader value (the short "simple" format, e.g."view, View logs, https://grafana.example.com/d/abc"). Forwarded verbatim;null/blank sends noActionsheader. This is the flat-string entry point used by environment/YAML/XML configuration. -
actions
Sets action buttons from typedNtfyActions, serialized to the ntfyActionsheader viaNtfyActionSerializer. ntfy caps a notification at three actions; extra entries andnullelements are dropped. Anull/empty list sends noActionsheader. Constructing an individualNtfyActionwith a blank label/url throws. -
excludedLoggerPrefixes
Sets the excluded logger prefixes from an explicit list (defensively copied, null-safe). -
excludedLoggers
Convenience: sets the excluded logger prefixes from a single comma-separated string, trimming each entry and dropping blanks. Anull/blank csv clears the list. -
excludedExceptionTypes
Sets the excluded exception types from an explicit list of fully qualified class names (defensively copied, null-safe, blanks dropped). -
excludedExceptionTypesCsv
Convenience: sets the excluded exception types from a single comma-separated string of fully qualified class names, trimming each entry and dropping blanks. Anull/blank csv clears the list. This is the spelling every adapter's flat configuration surface uses. -
cache
falseasks the server not to store the message (Cache: no), at the cost of every subscriber who is not connected at that moment. Defaulttrue. -
cache
Setscachefrom a raw configuration string, the spelling every flat surface hands over — an XML attribute, an environment variable, a properties entry.Exists so the answer to "what does
cache=yesmean" cannot differ between surfaces. Each adapter converting on its own getsBoolean.valueOf, which maps everything that is not"true"to false — soyeswould turn caching OFF and cost every offline subscriber their alerts, silently, on exactly the surfaces where the value is typed by hand. Anullleaves the default; an unreadable value leaves the default and is recorded for the engine to warn about atstart(). -
firebase
firebasefrom a raw configuration string. Seecache(String). -
firebase
falseasks the server not to forward the message to Firebase (Firebase: no), at the cost of push latency on the Google Play Android client. Defaulttrue.Independent of
cache(boolean)on purpose: a self-hosted server with no FCM configured wants this off and caching on, and one combined switch would make that unreachable. -
icon
Sets the notification icon URL (ntfyIconheader). Must be anhttp/httpsURL; a value that is not one is dropped with a diagnostic atstart()rather than sent. ntfy renders JPEG and PNG only, but the format is a property of the bytes served rather than of the path, so an extension naming another format only earns a warning. -
iconsByLoggerPrefix
Sets the logger-prefix → icon-URL table (defensively copied, null-safe). An entry with a blank half, or one whose URL no client could fetch, is dropped with a diagnostic atstart(), leaving the rest of the table working. A URL naming a format ntfy does not render is warned about but kept — the format lives in the bytes, not in the path. -
iconsByLoggerPrefixCsv
Convenience: the same table as a single string,prefix=urlpairs separated by commas — the spelling every adapter's flat configuration surface uses. Only the FIRST=of a pair separates prefix from URL, so a query string may contain more. -
includeMdcKeys
Sets the MDC-key allow-list from an explicit list (defensively copied, null-safe); anulllist clears it. Order is preserved and is the order the entries are rendered in. SeeNtfyConfig.getIncludeMdcKeys()— there is no wildcard form on purpose. -
includeMdcKeysCsv
Convenience: sets the MDC-key allow-list from a single comma-separated string, trimming each entry and dropping blanks. Anull/blank csv clears the list. This is the flat-string entry point used by environment/properties configuration.Deliberately a distinct method rather than a
String/Listoverload pair (matching the existingexcludedLoggerPrefixes/excludedLoggers(java.lang.String)precedent): an overload would make a barenullliteral ambiguous at the call site.Limitation: an MDC key containing a comma is unreachable from any CSV surface — use
includeMdcKeys(List)for that. -
enabled
-
asyncEnabled
Toggles asynchronous (offloaded) delivery of individual error alerts. On by default; setfalsefor pre-2.0 synchronous delivery. SeeNtfyConfig.isAsyncEnabled(). -
asyncQueueCapacity
Sets the bounded async delivery queue capacity (seeNtfyConfig.getAsyncQueueCapacity()). A non-positive value is clamped to a safe minimum by the engine at start. -
requireHttpsForCredentials
Toggles refusing activation when credentials would traverse a cleartexthttp://endpoint. On by default; setfalsefor the pre-2.0 warn-and-activate behavior. SeeNtfyConfig.isRequireHttpsForCredentials(). -
endpointFromClasspathFile
SeeNtfyConfig.isEndpointFromClasspathFile(); set byConfigLoaderonly. -
allowClasspathEndpoint
Explicit opt-in for activating from a classpath-only endpoint URL; seeNtfyConfig.isAllowClasspathEndpoint(). Off by default. -
startupPing
Selects the opt-in startup self-test mode (seeNtfyConfig.getStartupPing()). Anullargument resets to theStartupPingMode.OFFdefault. -
startupPing
Convenience overload parsing a configured string (off/probe/publish, case-insensitive) so the XML and properties surfaces bind without carrying their own parser.A
null/blank tag keeps the current value, and an UNRECOGNISED value keeps it too rather than throwing — the same lenient contract aslocale(String)and the numeric setters, so one typo in a config file can never take down the host application. The engine warns about the typo at start (it can tell "unset" from "unparseable" becauseStartupPingMode.fromValue(java.lang.String)returnsnullonly for the latter), and the caller may pre-check withfromValuewhen it wants to warn earlier. -
startupPingFailFast
Toggles aborting application startup when the self-test fails; seeNtfyConfig.isStartupPingFailFast(). Off by default, and also switches the self-test from background to inline execution when on. -
startupPingWarn
Selects the startup self-test mode for the WARN route (seeNtfyConfig.getStartupPingWarn()). Anullargument resets toStartupPingMode.OFF. -
startupPingWarn
Lenient string overload forstartup-ping-warn; seestartupPing(String). -
startupPingNotifyFailures
Toggles announcing a failed self-test on a route that passed; seeNtfyConfig.isStartupPingNotifyFailures(). On by default. -
locale
Sets the language of notification bodies and diagnostics (seeNtfyConfig.getLocale()). Anullargument resets to theLocale.ENGLISHdefault. -
locale
Convenience overload that parses a BCP 47 language tag (e.g."fr","de-DE") viaLocale.forLanguageTag(String). Anull/blank tag, or one whose language subtag is undetermined (garbage input, bare"und","und-Latn", private-use"x-..."— all of which parse to an emptyLocale.getLanguage()), keeps theLocale.ENGLISHdefault rather than silently selecting the undetermined locale. -
build
-