release 1.13.6: env-only machine paths and SSH hosts
Load ~/.config/taler-monitoring/env (taler-monitoring-env profiles) before suite defaults. Drop hardcoded operator homes and host aliases from scripts; apply/staging/www/secrets/wallet via env.
This commit is contained in:
parent
d7a0ceb90b
commit
0c94fb3d2e
32 changed files with 175 additions and 157 deletions
81
lib.sh
81
lib.sh
|
|
@ -1,5 +1,22 @@
|
|||
# shellcheck shell=bash
|
||||
# Shared helpers for taler-monitoring (laptop or koopa).
|
||||
#
|
||||
# Machine paths/SSH hosts: only from env (~/.config/taler-monitoring/env or
|
||||
# TALER_MONITORING_ENV=…), installed via taler-monitoring-env — never hardcode.
|
||||
|
||||
# Load host env once (before any := defaults)
|
||||
if [ "${_TALER_MON_ENV_LOADED:-0}" != "1" ]; then
|
||||
_mon_cfg="${TALER_MONITORING_ENV:-${XDG_CONFIG_HOME:-$HOME/.config}/taler-monitoring/env}"
|
||||
if [ -f "$_mon_cfg" ]; then
|
||||
# shellcheck disable=SC1090
|
||||
set -a
|
||||
# shellcheck disable=SC1091
|
||||
. "$_mon_cfg"
|
||||
set +a
|
||||
fi
|
||||
unset _mon_cfg
|
||||
export _TALER_MON_ENV_LOADED=1
|
||||
fi
|
||||
|
||||
# Default stack = GOA / hacktivism (overridden by TALER_DOMAIN / --domain)
|
||||
# i18n (en default; fr for FrancPaysan — see i18n.sh / TALER_MON_LANG)
|
||||
|
|
@ -22,9 +39,25 @@ fi
|
|||
: "${EXCHANGE_LOCAL:=http://127.0.0.1:9011}"
|
||||
: "${MERCHANT_LOCAL:=https://127.0.0.1:9010}"
|
||||
: "${LANDING_LOCAL:=http://127.0.0.1:9013}"
|
||||
: "${KOOPA_SSH:=koopa}"
|
||||
# When LAN Host "koopa" is unreachable, try WAN DNAT (see ~/.ssh/config Host koopa-external).
|
||||
: "${KOOPA_SSH_FALLBACKS:=koopa-external}"
|
||||
# Hostnames/paths: set via ~/.config/taler-monitoring/env (no hardcoded machine values).
|
||||
: "${KOOPA_SSH:=}"
|
||||
: "${KOOPA_SSH_FALLBACKS:=}"
|
||||
: "${INSIDE_SSH:=}"
|
||||
: "${FRANCPAYSAN_SSH:=}"
|
||||
: "${DEVTESTING_SSH:=}"
|
||||
: "${DEPLOY_SSH:=}"
|
||||
: "${FIRECUDA_SSH:=}"
|
||||
: "${HTML_OUT:=${HOME}/monitoring-sites-staging}"
|
||||
: "${DEPLOY_STAGING:=${HTML_OUT}}"
|
||||
: "${DEPLOY_WWW_ROOT:=}"
|
||||
: "${APPLY_MONITORING_LIVE:=}"
|
||||
: "${KOOPA_CADDY_DIR:=}"
|
||||
: "${FRANCPAYSAN_SECRETS:=}"
|
||||
: "${FRANCPAYSAN_REMOTE_SECRETS_ROOT:=}"
|
||||
: "${FRANCPAYSAN_REMOTE_BANK_ADMIN_SECRET:=}"
|
||||
: "${FRANCPAYSAN_REMOTE_BANK_EXPLORER_SECRET:=}"
|
||||
: "${FRANCPAYSAN_REMOTE_MERCHANT_TOKEN:=}"
|
||||
: "${WALLET_CLI:=}"
|
||||
: "${MERCHANT_INSTANCE:=goa-demo-cp4zqk}"
|
||||
# Merchant portal /private API: instance ids must be lowercase or you get odd 401s.
|
||||
# (Display names may use capitals; path segment /instances/{id}/ must not.)
|
||||
|
|
@ -235,13 +268,13 @@ apply_taler_domain() {
|
|||
: "${E2E_TEMPLATE_MAP:=5=oeufs-6 4.5=pain-seigle 6=jus-pomme 8.5=fromage-chevre 12=miel-printemps 25=panier-legumes}"
|
||||
: "${E2E_PAY_VALUES:=5 8.5 6}"
|
||||
: "${E2E_WITHDRAW_VALUES:=20 50}"
|
||||
# Inside checks as low-priv stagepaysan (podman, no sudo) — not koopa
|
||||
# Inside checks as low-priv stagepaysan (podman, no sudo) — not koopa.
|
||||
# INSIDE_SSH / container names: set in host env (no hardcoded SSH host).
|
||||
INSIDE_PROFILE="${INSIDE_PROFILE:-stage-lfp}"
|
||||
INSIDE_SSH="${INSIDE_SSH:-francpaysan-stage-user}"
|
||||
INSIDE_BANK_CTR="${INSIDE_BANK_CTR:-stage-lfp-bank}"
|
||||
INSIDE_EXCHANGE_CTR="${INSIDE_EXCHANGE_CTR:-stage-lfp-exchange-ansible}"
|
||||
INSIDE_MERCHANT_CTR="${INSIDE_MERCHANT_CTR:-stage-lfp-merchant}"
|
||||
# Host pasta ports (127.0.0.1 on francpaysan-host)
|
||||
# Host pasta ports (127.0.0.1 on the FP host (INSIDE_SSH))
|
||||
INSIDE_BANK_PORT="${INSIDE_BANK_PORT:-9032}"
|
||||
INSIDE_EXCHANGE_PORT="${INSIDE_EXCHANGE_PORT:-9031}"
|
||||
INSIDE_MERCHANT_PORT="${INSIDE_MERCHANT_PORT:-9030}"
|
||||
|
|
@ -381,7 +414,7 @@ mon_ssh_ok() {
|
|||
ssh "${SSH_BASE_OPTS[@]}" "$host" true >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Pick a working SSH host: KOOPA_SSH first, then KOOPA_SSH_FALLBACKS (koopa-external).
|
||||
# Pick a working SSH host: KOOPA_SSH first, then KOOPA_SSH_FALLBACKS (from env).
|
||||
# Sets KOOPA_SSH to the first host that answers. 0 = ok, 1 = none.
|
||||
KOOPA_SSH_RESOLVED=0
|
||||
resolve_koopa_ssh() {
|
||||
|
|
@ -1195,26 +1228,8 @@ if [ -z "$SECRETS_ROOT" ]; then
|
|||
SECRETS_ROOT="${KOOPA_ADMIN_SECRETS}/koopa/host-root"
|
||||
fi
|
||||
fi
|
||||
if [ -z "$SECRETS_ROOT" ]; then
|
||||
_mon_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
_admin_log="$(cd "${_mon_dir}/../.." && pwd)"
|
||||
for d in \
|
||||
"${_admin_log}/../koopa-admin-secrets/koopa/host-root" \
|
||||
"${_admin_log}/../../koopa-admin-secrets/koopa/host-root" \
|
||||
"${HOME}/taler/src/koopa-admin-secrets/koopa/host-root" \
|
||||
"${HOME}/src/koopa/koopa-admin-secrets/koopa/host-root" \
|
||||
"${HOME}/koopa-admin-secrets/koopa/host-root" \
|
||||
"/Users/newkamek/src/koopa/koopa-admin-secrets/koopa/host-root" \
|
||||
"$(cd "${_admin_log}/../.." 2>/dev/null && pwd)/koopa-admin-secrets/koopa/host-root"
|
||||
do
|
||||
# resolve .. without requiring the dir to exist first for cd
|
||||
if [ -d "$d/taler-bank" ]; then
|
||||
SECRETS_ROOT=$(cd "$d" && pwd)
|
||||
break
|
||||
fi
|
||||
done
|
||||
unset _mon_dir _admin_log d
|
||||
fi
|
||||
# No further home-path probes — set SECRETS_ROOT or KOOPA_ADMIN_SECRETS in env.
|
||||
|
||||
|
||||
read_secret() {
|
||||
local rel="$1" base val=""
|
||||
|
|
@ -1259,7 +1274,7 @@ secrets_hint() {
|
|||
Prefer a local secrets file (not committed):
|
||||
cp secrets.env.example secrets.env
|
||||
\$EDITOR secrets.env
|
||||
Or set SECRETS_ROOT=\$HOME/src/koopa/koopa-admin-secrets/koopa/host-root
|
||||
Or set SECRETS_ROOT / KOOPA_ADMIN_SECRETS in ~/.config/taler-monitoring/env
|
||||
Or export E2E_BANK_ADMIN_PASS / E2E_MERCHANT_TOKEN for one shot.
|
||||
EOF
|
||||
}
|
||||
|
|
@ -1299,14 +1314,10 @@ find_wallet_cli() {
|
|||
echo "$WALLET_CLI"; return 0
|
||||
fi
|
||||
local c cand
|
||||
for c in \
|
||||
# WALLET_CLI / WALLET_CLI_CANDIDATES from env; then portable package paths only.
|
||||
# shellcheck disable=SC2086
|
||||
for c in ${WALLET_CLI_CANDIDATES:-} \
|
||||
"${HOME}/.local/bin/taler-wallet-cli.mjs" \
|
||||
"${HOME}/taler/src/taler-typescript-core/packages/taler-wallet-cli/bin/taler-wallet-cli.mjs" \
|
||||
"${HOME}/src/taler-typescript-core/packages/taler-wallet-cli/bin/taler-wallet-cli.mjs" \
|
||||
"${HOME}/taler/opt/taler-wallet-cli/usr/lib/taler-wallet-cli/node_modules/taler-wallet-cli/bin/taler-wallet-cli.mjs" \
|
||||
/home/hernani/taler/opt/taler-wallet-cli/usr/lib/taler-wallet-cli/node_modules/taler-wallet-cli/bin/taler-wallet-cli.mjs \
|
||||
/home/hernani/taler/src/taler-typescript-core/packages/taler-wallet-cli/bin/taler-wallet-cli.mjs \
|
||||
/Users/newkamek/src/taler/taler-typescript-core/packages/taler-wallet-cli/bin/taler-wallet-cli.mjs \
|
||||
/usr/lib/taler-wallet-cli/node_modules/taler-wallet-cli/bin/taler-wallet-cli.mjs \
|
||||
/usr/share/taler-wallet-cli/bin/taler-wallet-cli.mjs
|
||||
do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue