Application service and state management. Holds long-lived references (database connections, env, etc.) that should persist across tools.namespace reloads. Services are maps of {:start sym :stop sym} started/stopped via start!/stop!.
Application service and state management. Holds long-lived references (database connections, env, etc.) that should persist across `tools.namespace` reloads. Services are maps of `{:start sym :stop sym}` started/stopped via `start!`/`stop!`.
(development?)Return true if env resolves to 'development'
Return true if env resolves to 'development'
(find-env)(find-env & keys)Look for the env value in the system properties, OS environment variables, or default to development
Look for the env value in the system properties, OS environment variables, or default to development
(production?)Return true if env resolves to 'production'
Return true if env resolves to 'production'
(resolution key)Returns a deref-able pointer to values stored in app, may return nil
Returns a deref-able pointer to values stored in app, may return nil
(resolution! key)Returns a deref-able pointer to values stored in app. An exception is throw when app does not have a value for the key.
Returns a deref-able pointer to values stored in app. An exception is throw when app does not have a value for the key.
(service start-sym stop-sym)The start and stop symbols must point to functions that:
The start and stop symbols must point to functions that: 1) start/stop the 'service' 2) add/remove data from app
(set-env! env)Imperatively set :env on the global app map. Prefer start-env inside
a service start fn for normal startup flow; set-env! is a convenience for
scripts and the REPL.
Imperatively set `:env` on the global `app` map. Prefer `start-env` inside a service start fn for normal startup flow; `set-env!` is a convenience for scripts and the REPL.
(start! services)Start each service in services in declaration order. Each service map's
:start symbol must point to a fn (fn [app] new-app) that updates the
global app map (typically by assoc-ing whatever resource it manages).
Start each service in `services` in declaration order. Each service map's `:start` symbol must point to a fn `(fn [app] new-app)` that updates the global `app` map (typically by `assoc`-ing whatever resource it manages).
(start-env app)(start-env app & keys)To be used as in a start service fn.
To be used as in a start service fn.
(stop! services)Stop services in reverse declaration order. Each service map's :stop
symbol must point to a fn (fn [app] new-app) that tears down the resource
and removes it from the global app map.
Stop services in *reverse* declaration order. Each service map's `:stop` symbol must point to a fn `(fn [app] new-app)` that tears down the resource and removes it from the global `app` map.
(stop-env app)To be used as in a stop service fn.
To be used as in a stop service fn.
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 |