This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-20
Channels
- # beginners (102)
- # boot (23)
- # cljs-dev (1)
- # clojure (52)
- # clojure-canada (7)
- # clojure-korea (2)
- # clojure-poland (1)
- # clojure-russia (35)
- # clojure-spec (39)
- # clojure-uk (5)
- # clojurescript (64)
- # cursive (11)
- # events (1)
- # hoplon (168)
- # lein-figwheel (2)
- # luminus (14)
- # off-topic (47)
- # om (3)
- # om-next (1)
- # onyx (31)
- # quil (4)
- # re-frame (21)
- # spacemacs (1)
- # sql (1)
- # untangled (3)
- # yada (4)
@yogthos whatโs blahlblah.handler.init-app state supposed to do?
for a standalone app it doesn't do anything by default, for a war it runs some initialization
Ah! ๐
the init/stop functions live in the blahblah.env
namespace found under env/dev/clj/blahblah/env.clj
and env/prod/clj/blahblah/env.clj
respectively
the default functions just log what mode the app is running in, so the dev one has:
(def defaults
{:init
(fn []
(parser/cache-off!)
(log/info "\n-=[memory_hole started successfully using the development profile]=-"))
:stop
(fn []
(log/info "\n-=[memory_hole has shut down successfully]=-"))
:middleware wrap-dev})
and the prod one:
(ns memory-hole.env
(:require [clojure.tools.logging :as log]))
(def defaults
{:init
(fn []
(log/info "\n-=[memory_hole started successfully]=-"))
:stop
(fn []
(log/info "\n-=[memory_hole has shut down successfully]=-"))
:middleware identity})
Thanks.
@yogthos do you know if I can access the return value of the start function in the stop function/
Or do I have to handle it myself, storing it in an atom for example.
that's how db state is setup for example:
(defstate ^:dynamic *db*
:start (conman/connect! {:jdbc-url (env :database-url)})
:stop (conman/disconnect! *db*))
the start function creates a connection, and the stop function stops itThe db! of course ๐ Thanks.
BTW, Iโm really glad you added a component system to Luminus and mount looks better than component ๐