A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys, Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun VPN routing, and a web dashboard to manage it all. Free & open forever to self-host; optional paid hosted services fund it. See PROMISE.md. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
50 lines
1.4 KiB
Bash
Executable File
50 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Show IP allocations
|
|
ip_show_allocations()
|
|
{
|
|
local filter="$1" # "all", "active", "released", app_name
|
|
|
|
echo ""
|
|
echo "🌐 IP Allocations"
|
|
echo "================="
|
|
echo ""
|
|
|
|
local sql="SELECT app_name, ip_address, subnet, status, purpose, allocated_date FROM ip_allocations"
|
|
|
|
case "$filter" in
|
|
"active")
|
|
sql="$sql WHERE status = 'active'"
|
|
;;
|
|
"released")
|
|
sql="$sql WHERE status = 'released'"
|
|
;;
|
|
"all")
|
|
# No filter
|
|
;;
|
|
*)
|
|
if [[ -n "$filter" ]]; then
|
|
sql="$sql WHERE app_name = '$filter'"
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
sql="$sql ORDER BY status DESC, allocated_date DESC;"
|
|
|
|
echo "📦 App | 🌐 IP Address | 🏠 Subnet | 📊 Status | 🎯 Purpose | 📅 Date"
|
|
echo "------|--------------|----------|----------|-----------|----------"
|
|
|
|
while IFS='|' read -r app_name ip_address subnet status purpose allocated_date; do
|
|
local status_icon="🟢"
|
|
case "$status" in
|
|
"released") status_icon="🔴" ;;
|
|
"conflict") status_icon="🟡" ;;
|
|
esac
|
|
|
|
printf "%-6s | %-12s | %-8s | %-8s | %-9s | %s\n" \
|
|
"$app_name" "$ip_address" "$subnet" "$status_icon $status" "$purpose" "$allocated_date"
|
|
done < <(sqlite3 "$docker_dir/$db_file" "$sql" 2>/dev/null)
|
|
|
|
echo ""
|
|
}
|