feat/queue-messages (#19)

Co-authored-by: jon brookes <marshyon@gmail.com>
Reviewed-on: https://codeberg.org/headshed/share-lt/pulls/19
This commit is contained in:
Jon Brookes 2026-02-09 18:09:35 +01:00
parent 1a22fd156d
commit 74bc17d019
9 changed files with 88 additions and 8 deletions

View file

@ -0,0 +1,46 @@
#!/usr/bin/env bash
# This script creates a NATS stream using the nats CLI tool.
# It reads the stream name, password, and subject from an .env file.
ENV_FILE=".env"
if [ ! -f "$ENV_FILE" ]; then
echo ".env file not found at $ENV_FILE"
exit 1
fi
. "$ENV_FILE"
if [ -z "$NATS_STREAM" ]; then
echo "NATS_STREAM is not set in .env file"
exit 1
fi
if [ -z "$NATS_PASSWORD" ]; then
echo "NATS_PASSWORD is not set in .env file"
exit 1
fi
if [ -z "$NATS_SUBJECT" ]; then
echo "NATS_SUBJECT is not set in .env file"
exit 1
fi
nats \
stream add "$NATS_STREAM" \
--user ruser --password $NATS_PASSWORD \
--subjects "$NATS_SUBJECT" \
--storage file \
--dupe-window="2m" \
--replicas=1 \
--max-msgs-per-subject=-1 \
--no-allow-rollup \
--no-deny-delete \
--no-deny-purge \
--discard=old \
--max-msgs=-1 \
--max-bytes=-1 \
--max-msg-size=-1 \
--max-age=1h \
--retention limits