   "Port index-set application listens on."
   {:default 3005 :type Long})
 
+(defconfig index-set-nrepl-port
+  "Port to listen for nREPL connections"
+  {:default nil
+   :parser cfg/maybe-long})
+
 (def
   ^{:doc "Defines the order to start the components."
     :private true}
-  component-order [:log :index :web])
+  component-order [:log :index :web :nrepl])
 
 (defn create-system
   "Returns a new instance of the whole application."

  http://stuartsierra.com/2013/09/15/lifecycle-composition and related posts."
  (:require [cmr.common.lifecycle :as lifecycle]
            [cmr.common.log :as log :refer (debug info warn error)]
            [cmr.index-set.api.routes :as routes]
            [cmr.common.api.web-server :as web]
            [cmr.system-trace.context :as context]

  (let [sys {:log (log/create-logger)
             :index (es/create-elasticsearch-store (es-config/elastic-config))
             :web (web/create-web-server (index-set-port) routes/make-api)
             :nrepl (nrepl/create-nrepl-if-configured (index-set-nrepl-port))
             :caches {acl/token-imp-cache-key (acl/create-token-imp-cache)}
             :zipkin (context/zipkin-config "index-set" false)
             :relative-root-url (transmit-config/index-set-relative-root-url)}]
