# `Antd.Discover`
[🔗](https://gitlab.com/autonomi/ant-sdk/-/tree/main/antd-elixir/blob/main/lib/antd/discover.ex#L1)

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.

# `discover_daemon_url`

```elixir
@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`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
