From 1107ed71e7bf6724a15ad54243eb533be3b76854 Mon Sep 17 00:00:00 2001 From: Teemu Patja Date: Sat, 4 Mar 2017 12:42:12 +0200 Subject: [PATCH 1/2] Fix REPL reload issues with db and http-server --- src/clj/commiteth/core.clj | 2 +- src/clj/commiteth/db/core.clj | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/clj/commiteth/core.clj b/src/clj/commiteth/core.clj index fac85a5..e617708 100644 --- a/src/clj/commiteth/core.clj +++ b/src/clj/commiteth/core.clj @@ -15,7 +15,7 @@ [["-p" "--port PORT" "Port number" :parse-fn #(Integer/parseInt %)]]) -(mount/defstate ^{:on-reload :noop} +(mount/defstate http-server :start (http/start diff --git a/src/clj/commiteth/db/core.clj b/src/clj/commiteth/db/core.clj index ab2e49c..31ee788 100644 --- a/src/clj/commiteth/db/core.clj +++ b/src/clj/commiteth/db/core.clj @@ -26,7 +26,9 @@ :migration-table-name "schema_migrations" :db db}] (migratus/migrate migratus-config) - (conman/connect! {:jdbc-url db}))) + (conman/bind-connection db "sql/queries.sql") + (conman/connect! {:jdbc-url db}) + db)) (defstate ^:dynamic *db* :start (start) From f8e7677c9ede49666a08d0196c6963dc88cc6009 Mon Sep 17 00:00:00 2001 From: Teemu Patja Date: Sat, 4 Mar 2017 13:01:32 +0200 Subject: [PATCH 2/2] Make swagger-ui available only for dev profile --- src/clj/commiteth/routes/services.clj | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/clj/commiteth/routes/services.clj b/src/clj/commiteth/routes/services.clj index d8bf155..2da22e4 100644 --- a/src/clj/commiteth/routes/services.clj +++ b/src/clj/commiteth/routes/services.clj @@ -13,6 +13,7 @@ [commiteth.github.core :as github] [clojure.tools.logging :as log] [commiteth.eth.core :as eth] + [commiteth.config :refer [env]] [crypto.random :as random] [clojure.set :refer [rename-keys]] [clojure.string :as str])) @@ -141,11 +142,12 @@ (defapi service-routes - {:swagger {:ui "/swagger-ui" - :spec "/swagger.json" - :data {:info {:version "0.1" - :title "commitETH API" - :description "commitETH API"}}}} + (when (:dev env) + {:swagger {:ui "/swagger-ui" + :spec "/swagger.json" + :data {:info {:version "0.1" + :title "commitETH API" + :description "commitETH API"}}}}) (context "/api" [] (GET "/top-hunters" []