chore(seed): name MxGateway connection per site (ScadaBridge Site <X>)
Replace the generic 'MxGateway Shared' connection name with a per-site name (site-a -> 'ScadaBridge Site A', env2 site-x -> 'ScadaBridge Site X') in both docker/ and docker-env2/ seed scripts.
This commit is contained in:
@@ -52,13 +52,14 @@ MXGW_CONFIG="{\"endpoint\":\"${MXGW_ENDPOINT}\",\"apiKey\":\"${MXGW_APIKEY}\",\"
|
||||
SITE_X_ID=$($CLI $URL $AUTH --format json site list \
|
||||
| python3 -c "import sys,json; print(next((s['id'] for s in json.load(sys.stdin) if s.get('siteIdentifier')=='site-x'), ''))" 2>/dev/null)
|
||||
if [ -n "$SITE_X_ID" ]; then
|
||||
echo " site-x (id=$SITE_X_ID): creating 'MxGateway Shared'..."
|
||||
CONN_NAME="ScadaBridge Site X"
|
||||
echo " site-x (id=$SITE_X_ID): creating '$CONN_NAME'..."
|
||||
$CLI $URL $AUTH data-connection create \
|
||||
--site-id "$SITE_X_ID" \
|
||||
--name "MxGateway Shared" \
|
||||
--name "$CONN_NAME" \
|
||||
--protocol "MxGateway" \
|
||||
--primary-config "$MXGW_CONFIG" \
|
||||
|| echo " (MxGateway connection may already exist on site-x)"
|
||||
|| echo " ('$CONN_NAME' may already exist on site-x)"
|
||||
else
|
||||
echo " (site-x not found — skipping MxGateway connection)"
|
||||
fi
|
||||
|
||||
@@ -83,13 +83,16 @@ for ident in site-a site-b site-c; do
|
||||
echo " ($ident not found — skipping MxGateway connection)"
|
||||
continue
|
||||
fi
|
||||
echo " $ident (id=$SITE_ID): creating 'MxGateway Shared'..."
|
||||
# Per-site connection name (e.g. site-a -> "ScadaBridge Site A").
|
||||
SITE_LETTER=$(printf '%s' "${ident#site-}" | tr '[:lower:]' '[:upper:]')
|
||||
CONN_NAME="ScadaBridge Site ${SITE_LETTER}"
|
||||
echo " $ident (id=$SITE_ID): creating '$CONN_NAME'..."
|
||||
$CLI $URL $AUTH data-connection create \
|
||||
--site-id "$SITE_ID" \
|
||||
--name "MxGateway Shared" \
|
||||
--name "$CONN_NAME" \
|
||||
--protocol "MxGateway" \
|
||||
--primary-config "$MXGW_CONFIG" \
|
||||
|| echo " (MxGateway connection may already exist on $ident)"
|
||||
|| echo " ('$CONN_NAME' may already exist on $ident)"
|
||||
done
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user