# `Hemdal.Config`
[🔗](https://github.com/altenwald/hemdal/blob/v1.4.0/lib/hemdal/config.ex#L1)

Hemdal needs to load a configuration to get the checks to be processed,
how to trigger the alerts and how to connect to the systems to perform
the checks.

This module define all of the data needed for the configuration and the
contract needed to be followed for the libraries which are going to act
as backend systems.

The backend is configured in the following way:

```elixir
# config/config.exs
config :hemdal, config_module: Hemdal.Config.Backend.Env
```

The possible backends and supported officially are:

- `Hemdal.Config.Backend.Env` which is configuring via `config.exs` in
  the Elixir configuration way.
- `Hemdal.Config.Backend.Json` which is using JSON files.

Check those modules to get further information about the implementation
and usage.

# `get_alert_by_id!`

```elixir
@callback get_alert_by_id!(id :: String.t()) :: Hemdal.Config.Alert.t() | nil
```

Retrieve an alert giving an `alert_id`.

# `get_all_alerts`

```elixir
@callback get_all_alerts() :: [Hemdal.Config.Alert.t()]
```

Get all of the alerts. It should provide a way to retrieve a list with
the alerts in the format defined by `Hemdal.Config.Alert` or an empty
list.

# `get_all_hosts`

```elixir
@callback get_all_hosts() :: [Hemdal.Config.Host.t()]
```

Retrieve all of the hosts. The implementation of this callback should
provide a list of `Hemdal.Config.Host` or an empty list.

# `get_host_by_id!`

```elixir
@callback get_host_by_id!(id :: String.t()) :: Hemdal.Config.Host.t() | nil
```

Retrieve the host giving a `host_id`.

# `get_alert_by_id!`

Retrieves the alert giving an `alert_id` using the configured backend.

# `get_all_alerts`

Retrieve all of the alerts using the configured backend.

# `get_all_hosts`

Retrieve all of the hosts using the configured backend.

# `get_host_by_id!`

Retrieve the host giving a `host_id` using the configured backend.

---

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