Initial fleet-api skill
This commit is contained in:
22
scripts/autorun.sh
Normal file
22
scripts/autorun.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SKILL_DIR="$(dirname "$(dirname "$0")")"
|
||||
|
||||
echo "=== Fleet API Setup ==="
|
||||
|
||||
# Create data directory
|
||||
DATA_DIR="${FLEET_DATA_DIR:-/data/fleet}"
|
||||
mkdir -p "$DATA_DIR"
|
||||
|
||||
# Initialize empty machines file if not exists
|
||||
if [ ! -f "$DATA_DIR/machines.json" ]; then
|
||||
echo '{}' > "$DATA_DIR/machines.json"
|
||||
echo "Initialized machines.json"
|
||||
fi
|
||||
|
||||
# Ensure scripts are executable
|
||||
chmod +x "$SKILL_DIR/scripts/"*.sh
|
||||
chmod +x "$SKILL_DIR/lib/"*.sh
|
||||
|
||||
echo "Fleet API setup complete"
|
||||
17
scripts/run.sh
Normal file
17
scripts/run.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SKILL_DIR="$(dirname "$(dirname "$0")")"
|
||||
source "$SKILL_DIR/lib/http.sh"
|
||||
source "$SKILL_DIR/lib/machines.sh"
|
||||
|
||||
PORT="${FLEET_API_PORT:-3001}"
|
||||
DATA_DIR="${FLEET_DATA_DIR:-/data/fleet}"
|
||||
|
||||
export DATA_DIR
|
||||
|
||||
echo "Starting Fleet API on port $PORT..."
|
||||
echo "Data directory: $DATA_DIR"
|
||||
|
||||
# Start HTTP server
|
||||
http_server "$PORT"
|
||||
Reference in New Issue
Block a user