Packages

ExClaw — OpenClaw rebuilt on ADK Elixir

Current section

Files

Jump to
ex_claw lib mix tasks ex_claw.gateway.ex
Raw

lib/mix/tasks/ex_claw.gateway.ex

defmodule Mix.Tasks.ExClaw.Gateway do
@moduledoc """
Starts the ExClaw Gateway as a foreground process.
mix ex_claw.gateway [--port PORT]
Options:
--port Port to listen on (default: 4000)
"""
use Mix.Task
@shortdoc "Start the ExClaw Gateway HTTP server"
@impl true
def run(args) do
{opts, _, _} = OptionParser.parse(args, strict: [port: :integer])
port = Keyword.get(opts, :port, 4000)
# Start all applications
Mix.Task.run("app.start")
# Start the gateway supervisor
{:ok, _pid} = ExClaw.Gateway.start_link(port: port, heartbeat: [paused: true])
Mix.shell().info("Gateway started on port #{port}")
Mix.shell().info(" Health: http://localhost:#{port}/health")
Mix.shell().info(" Status: http://localhost:#{port}/status")
Mix.shell().info(" Chat: POST http://localhost:#{port}/chat")
# Block forever
Process.sleep(:infinity)
end
end