Skip to content

Commit

Permalink
fix: Extract debug-interceptor to dev-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidz committed Jan 26, 2024
1 parent ddde8b1 commit 780c74f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/elin/component/interceptor.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@

(def ^:private default-manager
{e.c.kind/connect [e.i.connect/port-auto-detecting-interceptor
e.i.connect/output-channel-interceptor]
e.c.kind/nrepl [e.i.nrepl/debug-interceptor]})
e.i.connect/output-channel-interceptor]})
;; e.c.kind/evaluate [e.i.nrepl/eval-ns-interceptor]})

(def ^:private dev-manager
{e.c.kind/nrepl [e.i.nrepl/debug-interceptor]})

(defrecord Interceptor
[manager]
Expand Down Expand Up @@ -41,7 +44,9 @@
(interceptor/execute context (concat interceptors [terminator'])))))

(defn new-interceptor
[config]
(let [initial-manager (->> (get-in config [:interceptor :manager])
(reduce-kv assoc default-manager))]
[{:as config :keys [develop?]}]
(let [default-manager' (merge default-manager
(when develop? dev-manager))
initial-manager (->> (get-in config [:interceptor :manager])
(reduce-kv assoc default-manager'))]
(map->Interceptor {:manager (atom initial-manager)})))

0 comments on commit 780c74f

Please sign in to comment.