SPB Git forge

spb/market-atlas

Public
12commits 1branches 0releases
1.1 MBsize
maindefault branch
10 days agolast push
TypeScript 96.7% SQL 1.6% CSS 0.8% JavaScript 0.5%
1.2 KB · 20 lines shellscript
Raw Blame History
1#!/bin/bash2# Render deploy/market-atlas.mld.json with the real secrets and push it to the mld gateway (M1M32:~/dispatch/apps/).3# Usage: deploy/render-manifest.sh [--push]4# Secrets (git-ignored): deploy/.admin-token (generated if missing), deploy/.hfmd-key (hfmarketdata.io API key; optional, keyless limits otherwise).5set -euo pipefail6cd "$(dirname "$0")/.."7TOKEN_FILE=deploy/.admin-token8HFMD_FILE=deploy/.hfmd-key9[ -s "$TOKEN_FILE" ] || { openssl rand -hex 24 > "$TOKEN_FILE"; echo "generated $TOKEN_FILE"; }10TOKEN=$(tr -d '\n' < "$TOKEN_FILE")11HFMD_KEY=""12[ -s "$HFMD_FILE" ] && HFMD_KEY=$(tr -d '\n' < "$HFMD_FILE") || echo "warning: $HFMD_FILE missing — hfmarketdata connector will use keyless limits"13mkdir -p deploy/rendered14sed -e "s/{{ADMIN_TOKEN}}/$TOKEN/g" -e "s#{{HFMD_KEY}}#$HFMD_KEY#g" deploy/market-atlas.mld.json > deploy/rendered/market-atlas.json15python3 -c "import json; json.load(open('deploy/rendered/market-atlas.json')); print('manifest ok')"16if [ "${1:-}" = "--push" ]; then17  scp -q deploy/rendered/market-atlas.json M1M32:~/dispatch/apps/market-atlas.json18  ssh M1M32 'chmod 600 ~/dispatch/apps/market-atlas.json && echo "pushed to M1M32:~/dispatch/apps/market-atlas.json"'19fi20