Skip to content
Browse files

Runs everywhere, even on Heroku.

  • Loading branch information...
1 parent a618c4d commit ec04b39acd9fce81035dbdffbdeda39414925d46 @Raynes committed Oct 31, 2011
Showing with 11 additions and 2 deletions.
  1. +2 −0 project.clj
  2. +9 −2 src/tryclojure/core.clj
View
2 project.clj
@@ -4,5 +4,7 @@
[noir "1.2.0"]
[commons-lang/commons-lang "2.5"]
[clojail "0.4.6-beta4"]]
+ ;; For lein and Heroku compatibility. If you're using cake, add
+ ;; this line to .cake/config: jvm.opts = -Djava.security.policy=example.policy
:jvm-opts ["-Djava.security.policy=example.policy"]
:main tryclojure.core)
View
11 src/tryclojure/core.clj
@@ -140,6 +140,13 @@
(server/add-middleware wrap-file (System/getProperty "user.dir"))
-(defn tryclj [] (server/start (Integer. (System/getenv "PORT"))))
+(defn to-port [s]
+ (when-let [port s] (Long. port)))
-(defn -main [& args] (tryclj))
+(defn tryclj [port]
+ (server/start
+ (or (to-port port)
+ (to-port (System/getenv "PORT")) ;; For deploying to Heroku
+ 8801)))
+
+(defn -main [& args] (tryclj (first args)))

0 comments on commit ec04b39

Please sign in to comment.
Something went wrong with that request. Please try again.