Module registry and composition helpers for the Wagoe shell.
This namespace provides utilities to:
For now, only the :user module is supported.
Module registry and composition helpers for the Wagoe shell. This namespace provides utilities to: - Determine which modules are enabled based on configuration. - Compose route definitions from multiple modules. - Dispatch CLI commands to module-specific runners. For now, only the `:user` module is supported.
(compose-module-routes route-maps)Compose route definitions from multiple modules (new pattern).
Arguments: route-maps: collection of route maps from modules. Each route map has keys: :api, :web, :static.
Returns: Combined route map with merged routes: {:api [all-api-routes] :web [all-web-routes] :static [all-static-routes]}
Example: (compose-module-routes [{:api [['/users' {...}]] :web [] :static []} {:api [['/billing' {...}]] :web [] :static []}]) ;=> {:api [['/users' {...}] ['/billing' {...}]] ; :web [] ; :static []}
Compose route definitions from multiple modules (new pattern).
Arguments:
route-maps: collection of route maps from modules.
Each route map has keys: :api, :web, :static.
Returns:
Combined route map with merged routes:
{:api [all-api-routes]
:web [all-web-routes]
:static [all-static-routes]}
Example:
(compose-module-routes [{:api [['/users' {...}]] :web [] :static []}
{:api [['/billing' {...}]] :web [] :static []}])
;=> {:api [['/users' {...}] ['/billing' {...}]]
; :web []
; :static []}(dispatch-cli enabled-modules module->runner args)Dispatch CLI based on enabled modules.
Arguments: enabled-modules: vector of module keywords from config module->runner: map of module keyword to a function (fn [args] -> exit-code) args: raw CLI arguments vector
CLI convention: wagoe <module> <command> [options]
Dispatch CLI based on enabled modules. Arguments: enabled-modules: vector of module keywords from config module->runner: map of module keyword to a function (fn [args] -> exit-code) args: raw CLI arguments vector CLI convention: wagoe <module> <command> [options] - <module> is a keyword name like user or billing. - If <module> is omitted, and only one enabled module exists, that module is used by default. - If <module> is omitted and multiple modules are enabled, an error is reported and exit code 1 is returned. - If the selected module is not enabled or has no runner, exit code 1 is returned.
(enabled-modules config)Return the vector of enabled modules based on app config.
Looks at [:active :wagoe/settings :modules] in the configuration map. If no modules are configured, defaults to [:user] for backwards compatibility.
Return the vector of enabled modules based on app config. Looks at [:active :wagoe/settings :modules] in the configuration map. If no modules are configured, defaults to [:user] for backwards compatibility.
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 |