From 93a13637812a4fb6ee793ad50417ecde8af246b8 Mon Sep 17 00:00:00 2001 From: Edwin Watkeys Date: Sat, 6 Feb 2016 09:39:12 -0500 Subject: [PATCH 1/2] Add `:wrap` option for adding middleware --- src/gorilla_repl/core.clj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gorilla_repl/core.clj b/src/gorilla_repl/core.clj index 38057d3f6..41c0a3b03 100644 --- a/src/gorilla_repl/core.clj +++ b/src/gorilla_repl/core.clj @@ -26,7 +26,6 @@ (route/resources "/" {:root "gorilla-repl-client"}) (route/files "/project-files" {:root "."})) - (defn run-gorilla-server [conf] ;; get configuration information from parameters @@ -36,6 +35,8 @@ nrepl-requested-port (or (:nrepl-port conf) 0) ;; auto-select port if none requested nrepl-port-file (io/file (or (:nrepl-port-file conf) ".nrepl-port")) gorilla-port-file (io/file (or (:gorilla-port-file conf) ".gorilla-port")) + wrap (:wrap conf indentity) + app (wrap app-routes) project (or (:project conf) "no project") keymap (or (:keymap (:gorilla-options conf)) {}) _ (handle/update-excludes (fn [x] (set/union x (:load-scan-exclude (:gorilla-options conf)))))] @@ -49,7 +50,7 @@ ;; first startup nREPL (nrepl/start-and-connect nrepl-requested-port nrepl-port-file) ;; and then the webserver - (let [s (server/run-server #'app-routes {:port webapp-requested-port :join? false :ip ip :max-body 500000000}) + (let [s (server/run-server app {:port webapp-requested-port :join? false :ip ip :max-body 500000000}) webapp-port (:local-port (meta s))] (spit (doto gorilla-port-file .deleteOnExit) webapp-port) (println (str "Running at http://" ip ":" webapp-port "/worksheet.html .")) From 21d9b9a5a44374a2fff31f7f5772672968e512da Mon Sep 17 00:00:00 2001 From: Edwin Watkeys Date: Sun, 7 Feb 2016 10:22:07 -0500 Subject: [PATCH 2/2] fixed typo --- src/gorilla_repl/core.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gorilla_repl/core.clj b/src/gorilla_repl/core.clj index 41c0a3b03..ee1116ef1 100644 --- a/src/gorilla_repl/core.clj +++ b/src/gorilla_repl/core.clj @@ -35,7 +35,7 @@ nrepl-requested-port (or (:nrepl-port conf) 0) ;; auto-select port if none requested nrepl-port-file (io/file (or (:nrepl-port-file conf) ".nrepl-port")) gorilla-port-file (io/file (or (:gorilla-port-file conf) ".gorilla-port")) - wrap (:wrap conf indentity) + wrap (:wrap conf identity) app (wrap app-routes) project (or (:project conf) "no project") keymap (or (:keymap (:gorilla-options conf)) {})