From a72dac06cdfdf7bf5d5fd43eaf8f7b5f6fc64bc1 Mon Sep 17 00:00:00 2001 From: Joseph Burnett Date: Wed, 17 Oct 2018 14:07:34 -0400 Subject: [PATCH] Use PORT environment variable. --- serving/samples/helloworld-clojure/README.md | 4 +++- serving/samples/helloworld-clojure/src/helloworld/core.clj | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/serving/samples/helloworld-clojure/README.md b/serving/samples/helloworld-clojure/README.md index 9c96f44ad72..0e98701717e 100644 --- a/serving/samples/helloworld-clojure/README.md +++ b/serving/samples/helloworld-clojure/README.md @@ -36,7 +36,9 @@ following instructions recreate the source files from this folder. "!\n")}) (defn -main [& args] - (run-jetty handler {:port 8080})) + (run-jetty handler {:port (if-let [port (System/getenv "PORT")] + (Integer/parseInt port) + 8080)})) ``` 1. In your project directory, create a file named `project.clj` and copy the code diff --git a/serving/samples/helloworld-clojure/src/helloworld/core.clj b/serving/samples/helloworld-clojure/src/helloworld/core.clj index da005104063..abbcb308fba 100644 --- a/serving/samples/helloworld-clojure/src/helloworld/core.clj +++ b/serving/samples/helloworld-clojure/src/helloworld/core.clj @@ -12,4 +12,6 @@ "!\n")}) (defn -main [& args] - (run-jetty handler {:port 8080})) + (run-jetty handler {:port (if-let [port (System/getenv "PORT")] + (Integer/parseInt port) + 8080)}))