diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bfe8c7e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM php:8.4-cli-alpine + +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ +RUN apk add --no-cache tini +ENTRYPOINT [ "/sbin/tini", "--" ] + +RUN install-php-extensions pcntl posix mbstring sodium curl + +WORKDIR /app +COPY ./ntfid.phar /app/ntfid +COPY ./config.dist.yaml /app/config.yaml + +CMD [ "/app/ntfid", "--config", "/app/config.yaml" ] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..764b1ef --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +.PHONY: help all phar deb docker push + +help: + @echo "\e[1mTargets:\e[0m" + @echo " \e[3mall\e[0m — build everything\n \e[3mphar\e[0m — build the phar\n \e[3mdeb\e[0m — build deb package\n \e[3mdocker\e[0m — build container image" + +all: phar + +phar: + echo " '$(shell git describe --tags)', 'builddate' => '$(shell date)' ];" > src/build.php \ + && box compile \ + && echo "yay" + rm -f src/build.php + mv bin/ntfid.phar ./ntfid.phar + +deb: + fakeroot -- dpack build --type deb + +docker: + docker build -t dev.noccylabs.info/noccylabs/ntfi:latest . + +push: + docker push dev.noccylabs.info/noccylabs/ntfi:latest diff --git a/config.dist.yaml b/config.dist.yaml index ba4cddb..50c6c28 100644 --- a/config.dist.yaml +++ b/config.dist.yaml @@ -1,26 +1,9 @@ -# listen address -listen: "127.0.0.1:13000" +listen: "0.0.0.0:13000" -# these are the servers that the channels can use as destinations servers: default: server: ntfy.sh - # set to auth with token - token: ~ - # or set to auth as user - username: ~ - password: ~ -# this is where you can send messages to channels: - # redirect topics directly - serverevents: - destination: default/sometopicnameforserverevents - otherevents: - destination: default/someothertopicnameforevents - # parse and use only part of topic - "prefix_{topic}": - destination: prefixed/{topic} - # or append a prefix to the topic "{topic}": - destination: prefixing/prefix_{topic} + destination: "prefixing/{topic}" diff --git a/config.example.yaml b/config.example.yaml new file mode 100644 index 0000000..ba4cddb --- /dev/null +++ b/config.example.yaml @@ -0,0 +1,26 @@ +# listen address +listen: "127.0.0.1:13000" + +# these are the servers that the channels can use as destinations +servers: + default: + server: ntfy.sh + # set to auth with token + token: ~ + # or set to auth as user + username: ~ + password: ~ + +# this is where you can send messages to +channels: + # redirect topics directly + serverevents: + destination: default/sometopicnameforserverevents + otherevents: + destination: default/someothertopicnameforevents + # parse and use only part of topic + "prefix_{topic}": + destination: prefixed/{topic} + # or append a prefix to the topic + "{topic}": + destination: prefixing/prefix_{topic}