Fork me on GitHub

@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


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


hmm, so how would it be different if :lets was used instead of :letks?


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, 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?


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.


I found that. in dev-config.edn , this is not git version controlled, so cannot searched by ag.


@cmal yeah sorry, missed a spot in the docs when I switched from profiles.clj to dev-config.edn