This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-17
Channels
- # architecture (14)
- # aws (4)
- # aws-lambda (2)
- # beginners (66)
- # cider (63)
- # clara (39)
- # cljsjs (4)
- # cljsrn (3)
- # clojure (111)
- # clojure-berlin (5)
- # clojure-italy (17)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-uk (93)
- # clojurescript (19)
- # core-async (60)
- # cursive (13)
- # datomic (22)
- # devcards (2)
- # dirac (4)
- # duct (44)
- # emacs (18)
- # fulcro (1)
- # graphql (10)
- # jobs (13)
- # jobs-discuss (27)
- # lumo (1)
- # mount (1)
- # off-topic (22)
- # om-next (1)
- # onyx (16)
- # philosophy (3)
- # planck (4)
- # precept (34)
- # re-frame (66)
- # reagent (6)
- # ring (2)
- # ring-swagger (1)
- # shadow-cljs (333)
- # specter (8)
- # tools-deps (4)
- # vim (15)
- # yada (1)
Hi, I’m reading through the duct docs on configuration. It’s not clear to me, how you setup/handle production configuration, say setting db info in env vars, etc
@eoliphant Production settings that vary from machine to machine are typically passed in through environment variables, like DATABASE_URL
for instance. However, you can use other mechanisms, since the configuration is just a map.
The duct.module/sql
module uses it by default, similar to how the :duct.server.http/jetty
key uses the PORT
environment variable. You can use any environment variable you want, though, or any source of configuration you want.
#duct/env
gives you an easy way of pulling in environment variables into the configuration
I plan on revisiting the docs, but I’m currently finding myself a little too busy with non-open-source work.
No, please do
ok will do, everything else was pretty clear, was just stuck on how to 12-factor this thing lol
You can see an example of #duct/env
being used here: https://github.com/walkable-server/realworld-fulcro/blob/master/resources/conduit/config.edn
hi, i’m trying to using the duct-buddy middleware as follows:
:duct.router/ataraxy {:middleware {:jws-auth #ig/ref :duct.middleware.buddy/authentication}}
:duct.middleware.buddy/authentication
{:backend :jws
:secret #duct/env "JWT_SECRET"}
and [:post "/entries" {{:keys [description]} :body-params}]
^:jws-auth [:entries/create description]
[:post "/users/login" {{:keys [email password]} :body-params}]
[:users/login email password]
Are you putting your routes in :duct.module/ataraxy
or :duct.router/ataraxy
?
full routes as follows:
;## === routes ===
:duct.module/ataraxy
{[:get "/"] [:index]
[:get "/entries"]
^:jws [:entries/list]
[:get "/entries/" id]
^:jws-auth [:entries/find ^int id]
[:delete "/entries/" id]
^:jws-auth [:entries/destroy ^int id]
[:post "/entries" {{:keys [description]} :body-params}]
^:jws-auth [:entries/create description]
[:post "/users" {{:keys [email password]} :body-params}]
[:users/create email password]
[:post "/users/login" {{:keys [email password]} :body-params}]
[:users/login email password]
I think I’ll need to look into this in more detail. Can you open a issue on the Duct Ataraxy module?
Other than that, you could try replacing the middleware with one that has debug information.
It might be an issue with Buddy, the Duct Buddy middleware, or Ataraxy, or the Ataraxy module. I’d need to run a few tests.
You can add in your own middleware multimethod that wraps the Buddy middleware.
The Buddy middleware itself is pretty small:
https://github.com/duct-framework/middleware.buddy/blob/master/src/duct/middleware/buddy.clj
Yes, the metadata tells Ataraxy which result to apply the middleware to.
Ataraxy maps routes to results
So in the context of Ataraxy, the result handler is the function the route maps to.
I have the following problem:
In my duct config I have jetty component which initialises ok, but there is another one which fails resulting in the whole system not initialised.
Now, I can't fix the issue and do (reset)
in repl as the jetty address is in use. How can we automatically shut down all the components when the system as a whole is not initialised?
What version of Duct/Integrant/Integrant-REPL are you using @lambder? I seem to remember that the latest versions had better recovery on errors.