Skip to content

Commit

Permalink
system takes a port arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Dom Kiva-Meyer committed Jun 12, 2014
1 parent 9beceed commit 47fc380
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/omelette/main.clj
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
(ns omelette.main
(:gen-class)
(:require [com.stuartsierra.component :as component]
[omelette.route :as route]
[omelette.serve :as serve]))
[omelette.route :as route]
[omelette.serve :as serve]))

(def system
(component/system-map
:router (route/router)
:server (component/using
(serve/server)
[:router])))
(defn system
([] (system nil))
([port] (component/system-map
:router (route/router)
:server (component/using
(serve/server port)
[:router]))))

(defn browse [system]
(->> (get-in system [:server :port])
Expand All @@ -18,6 +19,6 @@
(.browse (java.awt.Desktop/getDesktop))))

(defn -main [& _]
(-> system
(-> (system)
component/start
browse))

0 comments on commit 47fc380

Please sign in to comment.