-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfincore
More file actions
executable file
·75 lines (65 loc) · 1.76 KB
/
Copy pathfincore
File metadata and controls
executable file
·75 lines (65 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
# SPDX-License-Identifier: BUSL-1.1
# SPDX-FileCopyrightText: 2026 FinCore Engine Authors
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
usage() {
cat <<'EOF'
fincore - FinCore Engine sandbox helper
Usage: fincore <command>
Commands:
init Scaffold a local .env with sandbox defaults
status Check the health of the running sandbox services
run-demo Run the ledger smoke demo (delegates to scripts/demo.sh)
help Show this help
EOF
}
cmd_init() {
local env_file="$ROOT_DIR/.env"
if [ -e "$env_file" ]; then
echo "$env_file already exists; leaving it untouched"
return 0
fi
cat >"$env_file" <<'EOF'
# FinCore Engine sandbox environment (local development only).
POSTGRES_PASSWORD=ledger
GRAFANA_ADMIN_PASSWORD=admin
EOF
echo "wrote $env_file"
echo "next: 'docker compose up -d', then 'fincore status'"
}
check() {
local name="$1" url="$2"
if curl -fsS -o /dev/null --max-time 5 "$url"; then
echo "UP $name ($url)"
else
echo "DOWN $name ($url)"
return 1
fi
}
cmd_status() {
local rc=0
check "ledger" "http://localhost:8080/actuator/health/readiness" || rc=1
check "payments" "http://localhost:8081/actuator/health/readiness" || rc=1
check "web" "http://localhost:8082/" || rc=1
return "$rc"
}
cmd_run_demo() {
exec "$ROOT_DIR/scripts/demo.sh" "$@"
}
main() {
local command="${1:-help}"
shift || true
case "$command" in
init) cmd_init ;;
status) cmd_status ;;
run-demo) cmd_run_demo "$@" ;;
help | -h | --help) usage ;;
*)
echo "unknown command: $command" >&2
usage >&2
exit 2
;;
esac
}
main "$@"