Files
ntfi/README.md
Christopher Vagnetoft d7aa344f09 Update readme
2026-01-17 18:32:17 +01:00

106 lines
2.9 KiB
Markdown

# Ntfi
This is a daemon with the single purpose of centralizing credentials and configuration for
pushing notifications to *ntfy.sh* or private instances of ntfy.
This daemon does **not** support subscriptions for now, only publishing.
> [!IMPORTANT]
> This is not a replacement for ntfy.sh, it is a complement to avoid having to
> configure multiple services in a stack, and to create abstractions for topic
> names.
## Building
Ntfi is built using **box**. You can compile it right away with `box compile`,
but the recommended way is using the Makefile to ensure the version information
is included:
```bash
$ make phar
```
## Using
Bare metal (Linux):
```bash
$ cp config.dist.yaml config.yaml
$ editor config.yaml
$ ./ntfid.phar --config config.yaml
```
With Docker:
```bash
$ cp config.dist.yaml config.yaml
$ editor config.yaml
$ docker exec --rm -it -p 13000:13000 -v $PWD/config.yaml:/app/config.yaml \
dev.noccylabs.info/noccylabs/ntfi:latest
```
With Docker Compose:
Make sure to create `config.yaml` from `config.dist.yaml` in the same directory
as the `compose.yaml` file.
```yaml
services:
ntfi:
image: dev.noccylabs.info/noccylabs/ntfi:latest
# only include ports if you need to publish from outside of the stack
ports:
- 13000:13000
volumes:
- ./config.yaml:/app/config.yaml
restart: always
```
## Configuration
### Listen
This is a single key defining the HTTP listen address. This defaults to
`0.0.0.0:13000`.
### Servers
Configure the servers that you want to be able to relay notifications to. The
default configuration defines a single server, `default` which is configured
to send messages to *ntfy.sh* as an anonymous user.
| Key | Req | Detail
| ----------- | :-: | ------------------------------------------------
| `server` | Y | The server name without protocol (always https)
| `token` | \- | API token to use when authenticating
| `username` | \- | Username for authenticating
| `password` | \- | Password for authenticating
> [!NOTE]
> Note that for authentication to work, you need to specify *either* `token`,
> *or* `username` *and* `password`. If `token` is empty, and only `username`
> or `password` is set, no authentication will be used.
### Channels
These are the channels that can be sent to. Each channel name matches the request
URL, and placeholders can be used to extract and reassemble a destination topic.
| Key | Req | Detail
| -------------- | :-: | ---------------------------------------------
| `destination` | Y | The destination, as `<server>/<topic>`
Examples:
```yaml
# match exact topic and send to rewritten topic
"serverevents":
destination: "default/sometopicnameforserverevents"
# parse and use only part of topic, sending to another server
"prefix_{topic}":
destination: "prefixed/{topic}"
# or append a prefix to the topic, sending to yet another server
"{topic}":
destination: "prefixing/prefix_{topic}"
```