Skip to content

Commit

Permalink
Fixed HTTPD setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryugi committed May 27, 2017
1 parent 4a69b77 commit 605c96d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/clj/timi/server/components/httpd.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
"Make app components available to request handlers."
[handler cpnt]
(fn [request]
(handler (assoc request :system cpnt))))
(handler (assoc request :component cpnt))))

(defrecord HTTPServer [ring-handler]
(defrecord HTTPServer [app-handler-fn]
component/Lifecycle

(start [component]
(log/info "Starting HTTP server ...")
(let [http-cfg (get-in component [:cfg-mgr :cfg :httpd])
handler (inject-app ring-handler component)
(let [app-cfg (get-in component [:cfg-mgr :cfg])
http-cfg (:httpd app-cfg)
handler (inject-app (app-handler-fn app-cfg) component)
server (httpkit/run-server handler http-cfg)]
(log/debug "Using config:" http-cfg)
(log/debug "Component keys:" (keys component))
Expand All @@ -31,5 +32,5 @@
(server))) ; calling server like this stops it, if started
(assoc component :httpd nil)))

(defn new-server [ring-handler]
(->HTTPServer ring-handler))
(defn new-server [app-handler-fn]
(->HTTPServer app-handler-fn))

0 comments on commit 605c96d

Please sign in to comment.