# `Rho.Dyn.Config`
[🔗](https://github.com/GenericJam/rho/blob/v0.1.0/lib/rho/dyn/config.ex#L1)

The host's settings for the Dyn layer, `config :rho, :dyn, [...]` (see
`Rho.Dyn`). Every key has a default; a host that doesn't use Dyn sets
none of them.

  * `:enabled`: `Rho.Supervisor` starts the Dyn processes (the Keeper
    and the approval store), adds the `dyn_*` tools to the registry's
    core tools and `Rho.Dyn.Source` to its sources. Default `false`;
    `Rho.Supervisor`'s `:dyn` option overrides it.
  * `:namespace`: the module namespace the agent writes in
    (`defmodule Dyn.Weather`), compiled as `<namespace>.G<n>.*`. Default
    `Dyn`. Fixed for an install: generations on disk name it. It may be
    below a Core prefix (Operator's `Operator.Dyn`, below `Operator`),
    but not below `Rho` (rho's own modules live there), nor at or above
    a Core prefix (the Core's modules would count as Dyn code and drop
    out of the runtime digest): `Rho.Dyn.Keeper` refuses to start then
    (`validate!/0`).
  * `:app`: the host's OTP application. Its version and modules are part
    of the Core (`Rho.Dyn.Compiler.runtime/0`: a new Core rebuilds every
    generation). Default `nil` (rho's own only).
  * `:core`: the host's own module prefixes (`[MyApp]`): its Core code,
    in the runtime digest and off limits to Dyn code except `:allowed`.
    `Rho` is always one. Default `[]`.
  * `:allowed`: Core modules Dyn code may call (`[MyApp.Files]`). `Rho.Tool`
    is always one. Default `[]`.
  * `:check`: the static check's lists, merged over its defaults
    (`Rho.Dyn.Check.defaults/0`: Operator's, except the entries naming
    Operator's own code): `:banned` (`%{module =>
    why}`), `:banned_erlang` (`%{atom => why}`), `:partial` (`%{module
    => [function]}`: allowed modules with forbidden functions), `:gated`
    (`%{prefix => [module]}`: only those modules below the prefix),
    `:forging` (`%{atom => why}`: atoms Dyn code may not hold),
    `:sigils` (`%{sigil_atom => module}`: template sigils whose
    expressions are code, expanded by that module's macro before the
    check), `:handlers` (`[{module, function, arity, index}]`: calls
    whose argument `index` is a `{Module, :function}` handler run later,
    checked as a call). A `nil` value drops a default entry.
  * `:screens`: the host's screen integration, a `Rho.Dyn.Screens`
    module. Default `Rho.Dyn.Screens.None` (no screens: the first
    "render" is the boot); a mob app sets `Rho.Dyn.Screens.Mob`.
  * `:guide`: text appended to `Rho.Dyn.agent_guide/0` (the host's own
    rules: its file roots, a menu Dyn code adds rows to, ...), a string
    or an MFA / 0-arity function. Default none.
  * The Keeper's options (`Rho.Dyn.Keeper`): `:approval`,
    `:probation_ms`, `:crash_limit`, `:on_stable`, ...

# `allowed`

```elixir
@spec allowed() :: [String.t()]
```

The Core modules Dyn code may call, as written.

# `app`

```elixir
@spec app() :: atom() | nil
```

The host's OTP application (`:app`), or nil.

# `check`

```elixir
@spec check() :: keyword()
```

The `:check` overrides as given (`Rho.Dyn.Check` merges them over its defaults).

# `core`

```elixir
@spec core() :: [String.t()]
```

The Core's module prefixes as written (`["Rho", "MyApp"]`).

# `enabled?`

```elixir
@spec enabled?() :: boolean()
```

Is `:enabled` set to `true`?

# `generation_prefix`

```elixir
@spec generation_prefix(non_neg_integer()) :: String.t()
```

The prefix of generation `n`'s module names, as atoms print (`"Elixir.Dyn.G3."`).

# `get`

```elixir
@spec get() :: keyword()
```

The whole `config :rho, :dyn` keyword list (`[]` when unset).

# `guide`

```elixir
@spec guide() :: String.t() | nil
```

The `:guide` text, resolved; nil when unset.

# `name`

```elixir
@spec name(module() | String.t()) :: String.t()
```

A module as written: `MyApp.Files` and `"MyApp.Files"` are `"MyApp.Files"`.

# `namespace`

```elixir
@spec namespace() :: module()
```

The namespace module (`Dyn` by default).

# `namespace_name`

```elixir
@spec namespace_name() :: String.t()
```

The namespace as written (`"Dyn"`, `"MyApp.Dyn"`).

# `namespace_segments`

```elixir
@spec namespace_segments() :: [atom()]
```

The namespace's alias segments (`[:MyApp, :Dyn]`).

# `screens`

```elixir
@spec screens() :: module()
```

The `:screens` module (`Rho.Dyn.Screens.None` by default).

# `under?`

```elixir
@spec under?(String.t(), String.t()) :: boolean()
```

Is `name` (as written) `prefix` or below it?

# `validate!`

```elixir
@spec validate!() :: :ok
```

Raises `ArgumentError` if the namespace is below `Rho`, or is a Core
prefix or above one (see `:namespace`).

---

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