Integrant system lifecycle management for Wagoe application.
This namespace defines init-key and halt-key! multimethods for all system components, providing proper lifecycle management and dependency injection for the entire application.
Components:
Usage: (require '[wagoe.config :as config]) (require '[wagoe.system-config :as sys-config]) ; your application's (require '[integrant.core :as ig]) (def cfg (sys-config/ig-config (config/load-config))) (def system (ig/init cfg)) (ig/halt! system)
Integrant system lifecycle management for Wagoe application. This namespace defines init-key and halt-key! multimethods for all system components, providing proper lifecycle management and dependency injection for the entire application. Components: - :wagoe/db-context - Database connection pool and adapter - :wagoe/user-repository - User data persistence - :wagoe/session-repository - Session data persistence - :wagoe/user-service - User business logic orchestration - :wagoe/logging - Structured logging and audit trails - :wagoe/metrics - Application and business metrics collection - :wagoe/error-reporting - Error tracking and alerting - :wagoe/http-handler - HTTP request routing and handling - :wagoe/http-server - Jetty HTTP server Usage: (require '[wagoe.config :as config]) (require '[wagoe.system-config :as sys-config]) ; your application's (require '[integrant.core :as ig]) (def cfg (sys-config/ig-config (config/load-config))) (def system (ig/init cfg)) (ig/halt! system)
(current-handler)Return the current live HTTP handler, or nil if not initialized.
Return the current live HTTP handler, or nil if not initialized.
(module-route-contributions contributions)Fold every module's routes into {:static [..] :web [..] :api [..]}.
A contribution is what a module's :wagoe/<name>-routes component returns:
{:static [..] mounted as-is :web [..] mounted under :web-prefix :api [..] versioned by the caller :web-prefix "/web/admin" optional, defaults to "/web" :extra-web [..] already-pathed routes, appended after the prefixed ones}
:extra-web exists for admin's slash redirect: /web/admin/ is the module's
/ route once prefixed, and the un-slashed /web/admin that people type
matched nothing and 404'd on a feature that works (BOU-229). That route is
admin's, is already absolutely pathed, and must not be prefixed again.
Order is the caller's: contributions are folded in the order given, and within a contribution static comes before web. Public so a test can drive it without an Integrant system.
Fold every module's routes into {:static [..] :web [..] :api [..]}.
A contribution is what a module's `:wagoe/<name>-routes` component returns:
{:static [..] mounted as-is
:web [..] mounted under :web-prefix
:api [..] versioned by the caller
:web-prefix "/web/admin" optional, defaults to "/web"
:extra-web [..] already-pathed routes, appended after the prefixed ones}
`:extra-web` exists for admin's slash redirect: `/web/admin/` is the module's
`/` route once prefixed, and the un-slashed `/web/admin` that people type
matched nothing and 404'd on a feature that works (BOU-229). That route is
admin's, is already absolutely pathed, and must not be prefixed again.
Order is the caller's: contributions are folded in the order given, and
within a contribution static comes before web. Public so a test can drive it
without an Integrant system.(restart! ig-cfg)Restart the system from ig-cfg (stop then start).
Takes the config for the same reason start! does.
Example: (restart! (wagoe.system-config/ig-config (wagoe.config/load-config)))
Restart the system from `ig-cfg` (stop then start). Takes the config for the same reason `start!` does. Example: (restart! (wagoe.system-config/ig-config (wagoe.config/load-config)))
(start! ig-cfg)Start the system from ig-cfg and remember it, halting any running one.
Takes the Integrant config rather than building it. Which components an
application runs is the application's decision — this used to resolve
wagoe.config/ig-config at runtime, so a library reached into the
composition root of whatever project happened to be on the classpath
(BOU-306).
Example: (start! (wagoe.system-config/ig-config (wagoe.config/load-config)))
Start the system from `ig-cfg` and remember it, halting any running one. Takes the Integrant config rather than building it. Which components an application runs is the application's decision — this used to resolve `wagoe.config/ig-config` at runtime, so a library reached into the composition root of whatever project happened to be on the classpath (BOU-306). Example: (start! (wagoe.system-config/ig-config (wagoe.config/load-config)))
(stop!)Stop the running system.
Returns: nil
Example: (stop!)
Stop the running system. Returns: nil Example: (stop!)
(swap-handler! new-handler)Replace the live HTTP handler. Called by devtools for router rebuilds.
Replace the live HTTP handler. Called by devtools for router rebuilds.
(system)The running system map, or nil when nothing was started through start!.
Introspection tools read integrant.repl.state/system, which only a REPL
(go) fills. A server started by wagoe.main is just as running and just
as worth inspecting, so this is where that answer lives (BOU-400).
The running system map, or nil when nothing was started through `start!`. Introspection tools read `integrant.repl.state/system`, which only a REPL `(go)` fills. A server started by `wagoe.main` is just as running and just as worth inspecting, so this is where that answer lives (BOU-400).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |