# `GeoGenius.Bootstrap`
[🔗](https://github.com/agoodway/geo_genius/blob/main/lib/geo_genius/bootstrap.ex#L1)

Optional supervised child that idempotently enqueues a configured desired
release at host boot.

GeoGenius does not add this to its own supervision tree -- starting a host
application must never download or import anything on its own. A host that
wants a release enqueued automatically places this child in its OWN
supervision tree, the same way `GeoGenius.Preflight` is left for a host to
place rather than shipped in `GeoGenius.Application`'s tree:

    children = [
      MyApp.Repo,
      {GeoGenius.Preflight, repo: MyApp.Repo},
      {GeoGenius.Bootstrap, repo: MyApp.Repo},
      MyAppWeb.Endpoint
    ]

and configures the desired release:

    config :geo_genius, :bootstrap,
      enabled: true,
      collection: "us_counties",
      release: "2026",
      publish: true

**Disabled by default.** `:enabled` defaults to `false`, so a host that
configures nothing under `:bootstrap` -- or configures it without flipping
`enabled: true` -- gets a no-op child every time. `:enabled` and `:publish`
are both compared against the literal value `true`, so a truthy-but-not-`true`
value (`enabled: "true"`, `publish: 1`) is treated as `false` rather than
coerced -- the safe direction for `:enabled`, and the same rule applied
consistently to `:publish`.

`:enabled`, `:collection`, `:release`, and `:publish` may each be passed to
`start_link/1` directly, and an explicit value there wins over
`config :geo_genius, :bootstrap` for that key, even when the explicit value
is `false` or `nil` and the configured one is not. Every other option is
forwarded to `GeoGenius.import/1` as given -- `:repo`, `:prefix`, `:runner`,
`:manifest_paths`, and so on -- so this child needs no configuration keys of
its own beyond the four above.

Modelled on `GeoGenius.Preflight`: `start_link/1` returns `:ignore`, so
nothing lingers in the supervision tree once the release has been enqueued
(or the child has decided there is nothing to enqueue). Unlike `Preflight`,
it never raises -- and that protection covers `start_link/1`'s entire body,
not just the call into `GeoGenius.import/1`. `import/1` returns
`{:error, exception}` for a manifest that cannot be resolved or a catalog
write that cannot complete, but it can also raise outside that pair -- a
bad runner, a missing `:collection`, a `Context.new/1` that cannot resolve
a Repo -- and resolving `:enabled` itself can raise on a malformed
`config :geo_genius, :bootstrap` (the wrong shape entirely, not just a
missing key). None of those may stop a host from booting: the host can
still read whatever release is already published. Every path -- the
error-tuple branch and anything raised, from `:enabled` resolution through
`GeoGenius.import/1` -- is logged at `:error`, and the child still returns
`:ignore` either way.

# `child_spec`

```elixir
@spec child_spec(keyword()) :: Supervisor.child_spec()
```

Builds the child spec for placing this bootstrap in a supervision tree.

# `start_link`

```elixir
@spec start_link(keyword()) :: :ignore
```

Enqueues the configured desired release, once, and returns `:ignore`.

When `:enabled` (opts, falling back to `config :geo_genius, :bootstrap`) is
not `true`, returns `:ignore` immediately without reading `:collection`,
`:release`, `:publish`, or calling `GeoGenius.import/1` at all.

---

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