55 lines
1.1 KiB
Bash
Executable File
55 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
BASE_DIR="/opt/appfactory"
|
|
CATALOG_FILE="$BASE_DIR/apps/catalog.yml"
|
|
OUTPUT_DIR="$BASE_DIR/gateway/static"
|
|
OUTPUT_FILE="$OUTPUT_DIR/apps.html"
|
|
|
|
mkdir -p "$OUTPUT_DIR"
|
|
|
|
cat > "$OUTPUT_FILE" <<'EOF'
|
|
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>AppFactory Apps</title>
|
|
<style>
|
|
body { font-family: Arial, sans-serif; margin: 40px; }
|
|
table { border-collapse: collapse; width: 100%; }
|
|
th, td { padding: 10px; border-bottom: 1px solid #ddd; text-align: left; }
|
|
th { background: #f5f5f5; }
|
|
a { color: #0066cc; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>AppFactory Apps</h1>
|
|
<table>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Status</th>
|
|
<th>Docs</th>
|
|
<th>Health</th>
|
|
</tr>
|
|
EOF
|
|
|
|
awk '
|
|
/- id:/ { id=$3 }
|
|
/^[[:space:]]+status:/ { status=$2 }
|
|
/^[[:space:]]+docs:/ { docs=$2 }
|
|
/^[[:space:]]+health:/ {
|
|
health=$2
|
|
if (id != "") {
|
|
print "<tr><td>" id "</td><td>" status "</td><td><a href=\"" docs "\">docs</a></td><td><a href=\"" health "\">health</a></td></tr>"
|
|
}
|
|
}
|
|
' "$CATALOG_FILE" >> "$OUTPUT_FILE"
|
|
|
|
cat >> "$OUTPUT_FILE" <<'EOF'
|
|
</table>
|
|
</body>
|
|
</html>
|
|
EOF
|
|
|
|
echo "Generated: $OUTPUT_FILE"
|