forked from mtusi2026/mtusi2026lab7
11 lines
547 B
Bash
Executable File
11 lines
547 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
# Rotate one KV value and recreate only the consumers; no image rebuild is needed.
|
|
VALUE=${1:?usage: openbao_rotation.sh NEW_DATABASE_URL}
|
|
TOKEN_FILE=${OPENBAO_TOKEN_FILE:-secrets/openbao_token.txt}
|
|
export BAO_ADDR=${BAO_ADDR:-http://127.0.0.1:8200}
|
|
export BAO_TOKEN=$(cat "$TOKEN_FILE")
|
|
bao kv put secret/messenger/database_url database_url="$VALUE" >/dev/null
|
|
OPENBAO_ENABLED=true docker compose up -d --force-recreate api1 api2 worker >/dev/null
|
|
echo "PASS: KV value rotated and consumers recreated without rebuilding images"
|