This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-20
Channels
- # architecture (25)
- # beginners (68)
- # cider (10)
- # clara (3)
- # cljs-dev (90)
- # cljsrn (16)
- # clojure (132)
- # clojure-austin (7)
- # clojure-berlin (3)
- # clojure-czech (1)
- # clojure-dusseldorf (1)
- # clojure-greece (5)
- # clojure-italy (39)
- # clojure-spec (5)
- # clojure-uk (78)
- # clojured (2)
- # clojurescript (92)
- # community-development (6)
- # cursive (7)
- # data-science (1)
- # datascript (14)
- # datomic (32)
- # duct (8)
- # emacs (5)
- # figwheel (3)
- # fulcro (47)
- # hoplon (12)
- # jobs (10)
- # luminus (16)
- # lumo (5)
- # off-topic (1)
- # onyx (2)
- # parinfer (47)
- # pedestal (6)
- # re-frame (10)
- # reagent (2)
- # reitit (61)
- # ring (8)
- # ring-swagger (16)
- # shadow-cljs (116)
- # sql (17)
- # utah-clojurians (2)
- # vim (1)
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?yes, i did come up with a solution, but perhaps it was a very good one. See https://github.com/feihong/re-frame-quickstart/commit/bb90c259c381180206d8228a099d2e9e235c7564. Basically, i made a call to (mount/start #'my-app.config/env)
before setting :basePath.
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 quickstart.routes.services.
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
@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
@timok if you’re curious, this is my solution: https://github.com/feihong/re-frame-quickstart/commit/efcdae3843dd17d920e49db04a8fdd2ba322b3eb