Commit 31e0f15d authored by Lisa's avatar Lisa

Feature: Interactive installer config prompts (gateway, port, token, capabilities, sexec)

parent b02c7a42
......@@ -64,23 +64,64 @@ rm -rf "$TMP"
echo "[3/5] Config..."
if [ ! -f "$CONFIG_DIR/config.json" ]; then
echo "[4/5] Creating config..."
NODE_HOST=$(hostname)
echo "[4/5] Configuring node..."
echo ""
# Gather settings interactively
read -p "Gateway host (default: localhost): " GATEWAY_HOST
GATEWAY_HOST="${GATEWAY_HOST:-localhost}"
read -p "Gateway port (default: 8765): " GATEWAY_PORT
GATEWAY_PORT="${GATEWAY_PORT:-8765}"
read -p "Token (leave empty to generate): " NODE_TOKEN
if [ -z "$NODE_TOKEN" ]; then
NODE_TOKEN=$(python3 -c "import secrets; print(secrets.token_hex(16))")
echo " Generated token: $NODE_TOKEN"
fi
# Select capabilities
echo ""
echo "Select capabilities:"
echo " 1) exec only"
echo " 2) exec + browser_control"
echo " 3) exec + browser_control + computer_control"
read -p "Choice [1-3] (default: 1): " CAP_CHOICE
case "${CAP_CHOICE:-1}" in
1) CAPABILITIES='["exec"]' ;;
2) CAPABILITIES='["exec", "browser_control"]' ;;
3) CAPABILITIES='["exec", "browser_control", "computer_control"]' ;;
*) CAPABILITIES='["exec"]' ;;
esac
# Ask about sexec
read -p "Enable sexec? (y/N): " ENABLE_SEXEC
SEXEC_LINE=""
if [[ "$ENABLE_SEXEC" =~ ^[Yy]$ ]]; then
SEXEC_LINE=' "sexec_path": "${HOME}/.config/hermes-node-agent/sexec/sexec.sh",'
echo " sexec will be installed at: $HOME/.config/hermes-node-agent/sexec/sexec.sh"
fi
NODE_NAME=$(hostname)
# Build config
cat > "$CONFIG_DIR/config.json" << END
{
"gateway_url": "wss://YOUR-GATEWAY-HOST:8765",
"node_name": "${NODE_HOST}",
"gateway_url": "wss://${GATEWAY_HOST}:${GATEWAY_PORT}",
"node_name": "${NODE_NAME}",
"token": "${NODE_TOKEN}",
"sexec_path": "${HOME}/.config/hermes-node-agent/sexec/sexec.sh",
${SEXEC_LINE}
"reconnect_interval": 5,
"heartbeat_interval": 30,
"capabilities": ["exec"]
"capabilities": ${CAPABILITIES}
}
END
echo ""
echo "✓ Config: $CONFIG_DIR/config.json"
else
echo "[4/5] Config exists — skipping"
echo " Config: $CONFIG_DIR/config.json"
fi
if [ "$RUN_AS_ROOT" = true ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment