pub async fn build(cfg: EngineConfig) -> Result<EmbeddedEngine>Expand description
Build engine for embedding. Internally:
- Open pool against
cfg.backendviaEngineBoot::run(which also runs engine + per-module schema migrations). - Bootstrap module contexts (auth, vault, workflow).
- Enforce preconditions — refuse to start when auth is on and the deployment has no operator users, no admin api-keys, and no external OIDC issuers (would lock the operator out).
- Compose
axum::Routerviacrate::server::build_app. - Spawn engine’s background tasks (events outbox cleanup; module-specific schedulers spawn during ctx construction).
Returns Err on any of: pool-open failure, migration failure,
ctx-build failure, precondition failure. The Err carries a
helpful operator-facing message when the cause is configuration.