36 lines
825 B
Bash
Executable File
36 lines
825 B
Bash
Executable File
#!/bin/sh
|
|
# script to bootstrap a nats stream
|
|
|
|
create_stream(){
|
|
local name subject
|
|
name="$1"; shift
|
|
subject="$1"; shift
|
|
|
|
if nats stream ls | grep -q "$name" 2>/dev/null; then
|
|
echo "stream $name already exists" >&2
|
|
|
|
return 0
|
|
fi
|
|
|
|
echo "Creating stream $name" >&2
|
|
|
|
nats stream add "$name" \
|
|
--subjects "$subject" \
|
|
--storage memory \
|
|
--replicas 1 \
|
|
--retention limits \
|
|
--discard old \
|
|
--max-msgs=-1 \
|
|
--max-msgs-per-subject=-1 \
|
|
--max-bytes=-1 \
|
|
--max-age=-1 \
|
|
--max-msg-size=-1 \
|
|
--dupe-window 2m0s \
|
|
--no-allow-rollup \
|
|
--no-deny-delete \
|
|
--no-deny-purge $@
|
|
}
|
|
|
|
create_stream com-infratographer 'com.infratographer.>'
|
|
create_stream com-equinixmetal 'com.equinixmetal.>'
|