(ns clojars.main
  (:require [clojars.scp]
            [ring.adapter.jetty :refer [run-jetty]]
            [clojars.web :refer [clojars-app]]
            [clojars.promote :as promote]
            [clojars.config :refer [config configure]]
            [clojure.tools.nrepl.server :as nrepl])
  (:import com.martiansoftware.nailgun.NGServer
           java.net.InetAddress)
  (:gen-class))

(defn start-jetty []
  (when-let [port (:port config)]
    (println "clojars-web: starting jetty on" (str "http://" (:bind config) ":" port))
    (run-jetty #'clojars-app {:host (:bind config)
                            :port port
                            :join? false})))

(defn start-nailgun []
  (when-let [port (:nailgun-port config)]
    (println "clojars-web: starting nailgun on" (str (:nailgun-bind config) ":" port))
    (.run (NGServer. (InetAddress/getByName (:nailgun-bin config)) port))))

(defn -main [& args]
  (configure args)
  (start-jetty)
  (nrepl/start-server :port (:nrepl-port config) :bind "127.0.0.1")
  (start-nailgun))

; (defonce server (run-jetty #'clojars-app {:port 8080 :join? false}))
(ns clojars.main
  (:require [clojars.scp]
            [ring.adapter.jetty :refer [run-jetty]]
            [clojars.web :refer [clojars-app]]
            [clojars.promote :as promote]
            [clojars.config :refer [config configure]]
            [clojure.tools.nrepl.server :as nrepl])
  (:import com.martiansoftware.nailgun.NGServer
           java.net.InetAddress)
  (:gen-class))

(defn start-jetty []
  (when-let [port (:port config)]
    (println "clojars-web: starting jetty on" (str "http://" (:bind config) ":" port))
    (run-jetty #'clojars-app {:host (:bind config)
                            :port port
                            :join? false})))

(defn start-nailgun []
  (when-let [port (:nailgun-port config)]
    (println "clojars-web: starting nailgun on" (str (:nailgun-bind config) ":" port))
    (.run (NGServer. (InetAddress/getByName (:nailgun-bin config)) port))))

(defn -main [& args]
  (alter-var-root #'*read-eval* (constantly false))
  (configure args)
  (start-jetty)
  (nrepl/start-server :port (:nrepl-port config) :bind "127.0.0.1")
  (start-nailgun))

; (defonce server (run-jetty #'clojars-app {:port 8080 :join? false}))
Work around dangerous default behaviour of Clojure.
Work around dangerous default behaviour of Clojure.

tobias/clojars-web,clojars/clojars-web,beppu/clojars-web,ato/clojars-web,codonnell/clojars-web,dotemacs/clojars-web,tobias/clojars-web,technomancy/clojars-web,clojars/clojars-web,ato/clojars-web,technomancy/clojars-web,nberger/clojars-web,xeqi/clojars-web,clojars/clojars-web,thiagofm/clojars-web,leonid-shevtsov/clojars-web,tobias/clojars-web,dotemacs/clojars-web,nberger/clojars-web,codonnell/clojars-web,xeqi/clojars-web