Files
scadaproj/docs/deploy/2026-11-22-prod-cvd-content/apply-btdb-connection.sh
T
Joseph Doherty 1ab2bca41d deploy(prod): CVD reactor content (Phase 7) — QA→PROD templates, API methods, BTDB, Z28061–Z28069 on site-par; mxgw SQL login + PAR NewJersey alarms
Plan docs/plans/2026-11-22-prod-cvd-content-copy.md with the QA findings, the hierarchical-name
binding remap (QA and PROD reuse Galaxy suffixes for different machines), BT checks, the run
status and the QA reactor disable. Generated inputs under docs/deploy/2026-11-22-prod-cvd-content/
(bindings, alarm-source overrides, mapping, QA export, BT preflight SQL, helper scripts; no secrets).
PROD plan §0.1a rows for the content run and the mxgw changes.

Claude-Session: https://claude.ai/code/session_01GT67AD5mc2BnaaAfY3hqqQ
2026-11-22 12:06:04 -05:00

18 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Create (or update) the PROD ScadaBridge db-connection "BTDB", shaped exactly like QA's.
# QA (decrypted 2026-11-22, password redacted):
# Server=wondersqlqa.zmr.zimmer.com;Database=BT;User Id=wonderapp;Password=***;TrustServerCertificate=True;MultiSubnetFailover=True
# PROD = same string with Server=wondersqlpd.zmr.zimmer.com.
# The password comes from $HISTORIAN_SQL_PASSWORD (~/.zshenv, the wonderapp login proven on PROD BT 2026-11-22).
# The connection string only ever exists in a 0600 temp file and is passed with --connection-string-file.
# usage: apply-btdb-connection.sh <sbp-wrapper> [create|update <id>]
set -euo pipefail
SBP=$1; MODE=${2:-create}; ID=${3:-}
source ~/.zshenv >/dev/null 2>&1 || true
: "${HISTORIAN_SQL_PASSWORD:?wonderapp password not in env}"
umask 077; F=$(mktemp); trap 'rm -f "$F"' EXIT
printf 'Server=wondersqlpd.zmr.zimmer.com;Database=BT;User Id=wonderapp;Password=%s;TrustServerCertificate=True;MultiSubnetFailover=True' "$HISTORIAN_SQL_PASSWORD" > "$F"
if [ "$MODE" = update ]; then "$SBP" db-connection update --id "$ID" --name BTDB --connection-string-file "$F"
else "$SBP" db-connection create --name BTDB --connection-string-file "$F"; fi
"$SBP" db-connection list