Fork me on GitHub

i created a new luminus project using +swagger. this is what my swagger spec looks like:

{:swagger {:ui "/swagger-ui"
             :spec "/swagger.json"
             :data {:basePath (:app-context env)
                        :info {:version "1.0.0"
                        :title "Sample API"
                        :description "Sample Services"}}}}
the problem is that (:app-context env), which comes from [quickstart.config :refer [env]], seems to be nil when the routes are set, so :basePath doesn’t receive the value that it should. is there a better way to set this up while preserving DRY?


I think I am having a similar issue. Do you have a solution?


yes, i did come up with a solution, but perhaps it was a very good one. See Basically, i made a call to (mount/start #'my-app.config/env) before setting :basePath.


*perhaps not a very good one


by my understanding, mount is supposed to know what order to start the defstates, but perhaps that doesn’t work in my case because there is no call to defstate in


Thanks, I thought about this as well. Not beautiful but if it works....


unless someone tells me otherwise, i think the best thing to do would be to put a call to (mount/start #'quickstart.config/env) inside -main to ensure that (:app-context env) has a value when setting up service routes


@lepistane your connection between the server and the client should be going over TLS, and if you can't trust TLS then there's really nothing you can do to make it secure


ultimately, the client has to pass the credentials to the server, and if those can be observed and replayed by a third party there's no way to make that secure at that point


so best practice is making sure everything goes over HTTPS, and you're using CSRF


@feihong.hsu the proper approach would be to use defstate for the swagger routes


using defstate ensures that resources are started in proper order and your env will be loaded before the swagger routes


@yogthos works perfectly! thx