Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
darkleaf committed Jul 2, 2024
1 parent 0b0d14d commit 2067e75
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion example/src/example/adapters/flyway.clj
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
(ns example.adapters.flyway
(:require
[darkleaf.di.core :as-alias di]
[example.adapters.hikari :as-alias hikari])
(:import
(org.flywaydb.core Flyway)))

(defn migrate [{ds `hikari/datasource}]
(defn migrate
{::di/kind :component}
[{ds `hikari/datasource}]
(.. (Flyway/configure)
(dataSource ds)
load
Expand Down
5 changes: 4 additions & 1 deletion example/src/example/adapters/reitit.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns example.adapters.reitit
(:require
[darkleaf.di.core :as-alias di]
[reitit.ring :as r]
[ring.middleware.keyword-params :as r.keyword-params]
[ring.middleware.params :as r.params]
Expand All @@ -10,7 +11,9 @@

(def route-data [])

(defn handler [{route-data `route-data}]
(defn handler
{::di/kind :component}
[{route-data `route-data}]
(-> route-data
(r/router)
(r/ring-handler #'default-handler)))
2 changes: 1 addition & 1 deletion example/src/example/system.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
::jetty/handler (di/ref `reitit/handler)
::hikari/options (di/template {:adapter "h2"
:url (di/ref "H2_URL")})}
(di/update-key `reitit/route-data conj `core/route-data)
(di/update-key `reitit/route-data conj (di/ref `core/route-data))
(di/add-side-dependency `flyway/migrate)
(di/env-parsing :env.long parse-long)
#_(if some-feature-flag
Expand Down

0 comments on commit 2067e75

Please sign in to comment.