Antd.Discover (antd v0.4.1)

Copy Markdown View Source

Auto-discovers the antd daemon by reading the daemon.port file that antd writes on startup.

The file contains up to three lines: REST port (line 1), gRPC port (line 2), and optionally the daemon PID (line 3).

If a PID is present and the process is no longer alive, the port file is considered stale and discovery returns empty.

Port file location is platform-specific:

  • Windows: %APPDATA%\ant\sdk\daemon.port
  • macOS: ~/Library/Application Support/ant/sdk/daemon.port
  • Linux: $XDG_DATA_HOME/ant/sdk/daemon.port or ~/.local/share/ant/sdk/daemon.port

The sdk subdirectory keeps antd's port file separate from the ant-node daemon, which writes to the same ant umbrella dir.

Summary

Functions

Reads the daemon.port file and returns the REST base URL (e.g. "http://127.0.0.1:8082").

Reads the daemon.port file and returns the gRPC target (e.g. "127.0.0.1:50051").

Functions

discover_daemon_url()

@spec discover_daemon_url() :: String.t()

Reads the daemon.port file and returns the REST base URL (e.g. "http://127.0.0.1:8082").

Returns "" if the port file is not found or unreadable.

discover_grpc_target()

@spec discover_grpc_target() :: String.t()

Reads the daemon.port file and returns the gRPC target (e.g. "127.0.0.1:50051").

Returns "" if the port file is not found or has no gRPC line.