# `WardrikDaemon.Server`

Runs the daemon.

    WardrikDaemon.Server.start_link(env: System.get_env())

It loads the env file into the environment, then starts in two stages:

  1. The store: in Postgres if `config.yaml`'s `storage` says so, or under the data directory.
  2. `WardrikDaemon.Running`, which reads the config, with secrets from the vault, and runs
     the rest.

The store starts first so the vault can be read. The vault's keys are `vault.keys` in
`config.yaml`, or `WARDRIK_VAULT_KEY`, or `vault_key` in the data home, made the first time.

It emits `[:wardrik_daemon, :started]` once the agents in `agents/` are defined.

## Options

  * `:env` - required. The environment, which names the directories and fills in `${NAME}`s.
  * `:name` - what Wardrik is reached by. `WardrikDaemon.Wardrik` unless set.
  * `:capabilities` - the tools agents may name. `WardrikDaemon.Capabilities.all/1` unless set.
  * `:store` - a store to use in place of the one on disk, for tests.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

```elixir
@spec start_link(keyword()) :: Supervisor.on_start()
```

Starts the daemon. Fails, with the reason, if `config.yaml` or a policy doesn't read.

---

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