This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-18
Channels
- # architecture (14)
- # beginners (89)
- # cider (336)
- # cljsrn (2)
- # clojure (181)
- # clojure-berlin (1)
- # clojure-dusseldorf (3)
- # clojure-finland (4)
- # clojure-germany (5)
- # clojure-italy (18)
- # clojure-norway (10)
- # clojure-spec (9)
- # clojure-uk (94)
- # clojurescript (84)
- # cursive (3)
- # data-science (4)
- # datomic (82)
- # emacs (2)
- # events (4)
- # figwheel (1)
- # fulcro (6)
- # graphql (2)
- # hoplon (46)
- # instaparse (24)
- # jobs (9)
- # lein-figwheel (2)
- # luminus (18)
- # lumo (3)
- # mount (1)
- # off-topic (14)
- # onyx (17)
- # parinfer (22)
- # planck (1)
- # protorepl (1)
- # re-frame (50)
- # reagent (7)
- # ring-swagger (6)
- # rum (4)
- # shadow-cljs (94)
- # spacemacs (9)
- # specter (7)
- # tools-deps (2)
- # uncomplicate (4)
- # vim (33)
@alexchalk17 yeah that part isn't obvious, the user
comes from here:
(defmethod restructure-param :current-user
[_ binding acc]
(update-in acc [:letks] into [binding `(:identity ~'+compojure-api-request+)]))
compojure-api is injecting the user in the :current-user
key, and it's a reverse binding where the user symbol gets populated with the value of the :current-user
key
a bit of docs on that here http://www.luminusweb.net/docs/services.html#authentication
So if I’ve understood, that method says ’when the metadata key is :current-user, bind its value’s symbol (`binding`) to (:identity ~'+compojure-api-request+)
?
yeah so original data comes from the :identity
key in the request, and it's injected into the :current-user
key in the route declaration, and that key is mapped to the user
symbol that you end up using in the route
Is user
a key in (:identity ~'+compojure-api-request+)
whose value we’re retrieving? i.e. would the result be different if we changed user
to present-user
? (As opposed to a let binding which would just assign all of (:identity ~'+compojure-api-request+)
to whatever var we picked?) That’s my best guess at the difference?
The user
is the symbol that ends up being used in the route declaration, you can call it present-user
, or anything. Technically, this is just a convenience anyways, you could pull the identity directly from the request, e.g:
(GET "/myroute" request
(let [user (:identity request_] ...))
@U050CBXUZ in that case it doesn’t look like a keybinding at all, it’s just a regular let binding from what I can see. So do you know when [:lets]
should be used instead of [:letks]
?
it's mostly preference, and yeah it's just the funky syntax that particular macro uses where you're effectively binding in reverse going from key to the symbol
I’m just trying to understand how your code would function differently if you’d used [:lets]
?
Normally I would go straight to the source-code, but in this case I found it super-complicated.
Is it purely the ordering in which the bindings are done? I can’t find any other difference…
:lets, a vector of let bindings applied first before the actual body
:letks, a vector of letk bindings applied second before the actual body
Hi, I am trying to add postgres into my luminus project. I used +postgres
to generate my luminus
project. Now I want to add the connection URL into my project so that I can access the postgres database.
In the docs.md
, I found
Create the database for your application.
* Update the connection URL in the `profiles.clj` file with your database name and login
but I cannot find the profiles.clj
file in my project. I also found there is a :database-url
in my app.config/env
variable whose value is
but I cannot find where this is defined. Can anyone help me out?I found the answer in https://github.com/luminus-framework/conman
But I am confusing why the :database-url
key can not be loaded by (load-config)
when setting in config.edn
while other key-values works well.