feat/docker-compose-update (#18)

Co-authored-by: jon brookes <marshyon@gmail.com>
Reviewed-on: https://codeberg.org/headshed/share-lt/pulls/18
This commit is contained in:
Jon Brookes 2026-02-08 18:04:18 +01:00
parent fd43495e2d
commit 1a22fd156d
70 changed files with 1068 additions and 745 deletions

33
cmd/handle_cms_updates.sh Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
LOG_FILE="/tmp/logfile.log"
# Redirect all output to both stdout and the log file
exec > >(tee -a "$LOG_FILE") 2>&1
# Read the first two command line arguments
ACTION=$1
FILENAME=$2
# Check if the file exists and echo its contents
if [[ -f "$FILENAME" ]]; then
echo "Contents of the file $FILENAME:"
cat "$FILENAME" | jq
else
echo "Error: File $FILENAME does not exist."
fi
echo
# Read and print command line arguments
echo "=============================="
echo "ACTION: $ACTION"
echo "FILENAME: $FILENAME"
echo "=============================="
echo
# Publish message and check return code
if nats pub $NATS_SUBJECT "$(cat "$FILENAME")" --server $NATS_URL --user $NATS_USERNAME --password $NATS_PASSWORD; then
echo "Success: Message published to NATS successfully."
else
echo "Error: Failed to publish message to NATS."
fi