 
 (ns catacumba.impl.server
   (:require [catacumba.utils :as utils]
-            [catacumba.impl.helpers :as helpers]
+            [catacumba.impl.helpers :as ch]
             [catacumba.impl.websocket :as websocket]
             [catacumba.impl.handlers :as handlers]
             [clojure.java.io :as io]
             [environ.core :refer [env]])
   (:import ratpack.server.RatpackServer
            ratpack.server.ServerConfig
+           ratpack.server.BaseDir
            ratpack.server.RatpackServerSpec
            ratpack.registry.RegistrySpec
            ratpack.ssl.SSLContexts

  "
  ([handler] (run-server handler {}))
  ([handler options]
   (let [^Action callback (helpers/action #(configure-server % handler options))
         ^RatpackServer server (RatpackServer/of callback)]
     (.start server)
    server)))


(defmethod setup-handler :catacumba/router
  [handler ^RatpackServerSpec spec]
  (.handlers spec ^Action (ch/fn->action handler)))

(defmethod setup-handler :default
  [handler ^RatpackServerSpec spec]
  (.handler spec (reify Function
                   (apply [_ _]
                     (handlers/adapter handler)))))

(defn- bootstrap-registry
  "A bootstrap server hook for setup initial
