#!/usr/bin/env bash
# NATS entrypoint wrapper for dev environment
# Reads credentials from Vault secrets and starts NATS
set -euo pipefail

# Read NATS credentials from Vault Agent-rendered files
NATS_USER="$(cat /vault/secrets/NATS_USER)"
NATS_PASSWORD="$(cat /vault/secrets/NATS_PASSWORD)"

# Start NATS with JetStream
exec nats-server \
  --jetstream \
  --store_dir=/data \
  --http_port=8222 \
  --port=4222 \
  --server_name=dev-nats \
  --user="${NATS_USER}" \
  --pass="${NATS_PASSWORD}"
